Main Menu

Added Main Menu scene
Tweaked world map to incorporate secondary colors in zone icons + glowing links
Entity Serialization is now generic
Zone Serialization now includes entities
Fixed bug where wormhole traversal would unbind from player entity
Game Manager no longer spawns entities (loadout file format changed)
Wrote extension to randomly select weighted items from collections (for generating enemies)
This commit is contained in:
Reinier Vens 2021-03-13 03:23:58 +00:00
commit e6181c11dc
53 changed files with 3763 additions and 49169 deletions

View file

@ -58,7 +58,7 @@ Material:
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _Depth: 20
- _Depth: 40
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1

View file

@ -0,0 +1,83 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Main Menu Ambient Fog Tint
m_Shader: {fileID: 4800000, guid: 268da230635cfb34ab4ed6ad39503fa0, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _Depth: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _Frequency: 6.2832
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _Phase: 0
- _Power: 0.5
- _SinePower: 1.25
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View file

@ -1,7 +1,8 @@
fileFormatVersion: 2
guid: e800a6f4972a199459fa2c2bc84e677e
DefaultImporter:
guid: 6b57537adfa3e9c41b904f7a2d611e15
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,83 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Main Menu Sun Fog Tint
m_Shader: {fileID: 4800000, guid: 268da230635cfb34ab4ed6ad39503fa0, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _Depth: 2.9
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _Frequency: 6.2832
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _Phase: 0
- _Power: 0.5
- _SinePower: 1.25
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 0.60475, b: 0.411, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b9f52544f98f47146b486fb6e27179bb
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -59,7 +59,7 @@ Material:
- _BumpScale: 1
- _Constant: 9
- _Cutoff: 0.5
- _Depth: -53.6
- _Depth: -30
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _Frequency: 0.01

View file

@ -78,6 +78,6 @@ Material:
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 0.5058824, b: 0.86, a: 1}
- _Color: {r: 1, g: 0.53900003, b: 0.86855793, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View file

@ -74,7 +74,7 @@ Material:
- _SinePower: 1.25
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _Speed: 20
- _Speed: 10
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1

View file

@ -0,0 +1,65 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Fog Marching Main Menu
m_Shader: {fileID: 4800000, guid: 7a890b6ceccf53c44bfc54b18b5daa58, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _Displacement:
m_Texture: {fileID: 8400000, guid: 06ec5ef8a5830fc44b1ac1a6e123add5, type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Patch:
m_Texture: {fileID: 8400000, guid: c618a6b20b3c7394590c59a9fa467e86, type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Surface:
m_Texture: {fileID: 8400000, guid: 2fc21a9d3e9647948b56e384cd9378b3, type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _TintTexture:
m_Texture: {fileID: 8400000, guid: d196505464047f04a97f28689041209b, type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _AlphaFloor: 0
- _DepthBlend: 512
- _DepthCeiling: 4096
- _Gamma: 0.3
- _GridCeilingBlend: -300
- _GridCeilingDensity: 0.01
- _GridCeilingFollow: 0
- _GridCeilingOffset: 0
- _GridFillDensity: 0.00002
- _GridFloorBlend: 39.6
- _GridFloorDensity: 1
- _GridFloorOffset: -16.46
- _GridPatchBlend: 200
- _GridPatchDensity: 3
- _NoiseFrequency: 0.01
- _NoiseSpeed: 0.01
- _NoiseStrength: 150
- _SafetyDistance: 50
- _StepExponent: 2
- _TintExponent: 8
m_Colors:
- _Tint: {r: 0.34, g: 0.34, b: 0.34, a: 1}
m_BuildTextureStacks: []

View file

@ -1,8 +1,8 @@
fileFormatVersion: 2
guid: a653dd22f90da7d43a7a6d02ff36d451
folderAsset: yes
DefaultImporter:
guid: e21702a5e6e98b7409d6913663ceab7e
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View file

@ -7,7 +7,7 @@ Material:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Jittered Grid Fog Marching
m_Name: Fog Marching
m_Shader: {fileID: 4800000, guid: 7a890b6ceccf53c44bfc54b18b5daa58, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4

View file

@ -28,7 +28,7 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ColorRamp:
m_Texture: {fileID: 0}
m_Texture: {fileID: 2800000, guid: 4f6a7385479a85a40be0c3030504c7c5, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:

View file

@ -0,0 +1,80 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Galaxy Zone Background Primary
m_Shader: {fileID: 203, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: d4144ee6db2bf3c468cc5010acfe8974, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _InvFade: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _TintColor: {r: 0.5283019, g: 0.5283019, b: 0.5283019, a: 1}
m_BuildTextureStacks: []

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6c332e6d0be83ac459c05a7cf5b90ed1
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -7,7 +7,7 @@ Material:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Galaxy Zone Background
m_Name: Galaxy Zone Background Secondary
m_Shader: {fileID: 203, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
@ -76,5 +76,5 @@ Material:
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _TintColor: {r: 0.79607844, g: 0.79607844, b: 0.79607844, a: 1}
- _TintColor: {r: 0.6226415, g: 0.6226415, b: 0.6226415, a: 1}
m_BuildTextureStacks: []

View file

@ -86,7 +86,7 @@ Material:
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _Scale: 9.308572
- _Scale: 8.580017
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1

View file

@ -34,164 +34,169 @@ namespace UniRx
public static CullingMode cullingMode = CullingMode.Self;
#if UNITY_EDITOR
// In UnityEditor's EditorMode can't instantiate and work MonoBehaviour.Update.
// EditorThreadDispatcher use EditorApplication.update instead of MonoBehaviour.Update.
class EditorThreadDispatcher
{
static object gate = new object();
static EditorThreadDispatcher instance;
public static EditorThreadDispatcher Instance
{
get
{
// Activate EditorThreadDispatcher is dangerous, completely Lazy.
lock (gate)
{
if (instance == null)
{
instance = new EditorThreadDispatcher();
}
return instance;
}
}
}
ThreadSafeQueueWorker editorQueueWorker = new ThreadSafeQueueWorker();
EditorThreadDispatcher()
{
UnityEditor.EditorApplication.update += Update;
}
public void Enqueue(Action<object> action, object state)
{
editorQueueWorker.Enqueue(action, state);
}
public void UnsafeInvoke(Action action)
{
try
{
action();
}
catch (Exception ex)
{
Debug.LogException(ex);
}
}
public void UnsafeInvoke<T>(Action<T> action, T state)
{
try
{
action(state);
}
catch (Exception ex)
{
Debug.LogException(ex);
}
}
public void PseudoStartCoroutine(IEnumerator routine)
{
editorQueueWorker.Enqueue(_ => ConsumeEnumerator(routine), null);
}
void Update()
{
editorQueueWorker.ExecuteAll(x => Debug.LogException(x));
}
void ConsumeEnumerator(IEnumerator routine)
{
if (routine.MoveNext())
{
var current = routine.Current;
if (current == null)
{
goto ENQUEUE;
}
var type = current.GetType();
if (type == typeof(AsyncOperation))
{
var asyncOperation = (AsyncOperation)current;
editorQueueWorker.Enqueue(_ => ConsumeEnumerator(UnwrapWaitAsyncOperation(asyncOperation, routine)), null);
return;
}
else if (type == typeof(WaitForSeconds))
{
var waitForSeconds = (WaitForSeconds)current;
var accessor = typeof(WaitForSeconds).GetField("m_Seconds", BindingFlags.Instance | BindingFlags.GetField | BindingFlags.NonPublic);
var second = (float)accessor.GetValue(waitForSeconds);
editorQueueWorker.Enqueue(_ => ConsumeEnumerator(UnwrapWaitForSeconds(second, routine)), null);
return;
}
else if (type == typeof(Coroutine))
{
Debug.Log("Can't wait coroutine on UnityEditor");
goto ENQUEUE;
}
#if SupportCustomYieldInstruction
else if (current is IEnumerator)
{
var enumerator = (IEnumerator)current;
editorQueueWorker.Enqueue(_ => ConsumeEnumerator(UnwrapEnumerator(enumerator, routine)), null);
return;
}
#endif
ENQUEUE:
editorQueueWorker.Enqueue(_ => ConsumeEnumerator(routine), null); // next update
}
}
IEnumerator UnwrapWaitAsyncOperation(AsyncOperation asyncOperation, IEnumerator continuation)
{
while (!asyncOperation.isDone)
{
yield return null;
}
ConsumeEnumerator(continuation);
}
IEnumerator UnwrapWaitForSeconds(float second, IEnumerator continuation)
{
var startTime = DateTimeOffset.UtcNow;
while (true)
{
yield return null;
var elapsed = (DateTimeOffset.UtcNow - startTime).TotalSeconds;
if (elapsed >= second)
{
break;
}
};
ConsumeEnumerator(continuation);
}
IEnumerator UnwrapEnumerator(IEnumerator enumerator, IEnumerator continuation)
{
while (enumerator.MoveNext())
{
yield return null;
}
ConsumeEnumerator(continuation);
}
}
#endif
// #if UNITY_EDITOR
//
// // In UnityEditor's EditorMode can't instantiate and work MonoBehaviour.Update.
// // EditorThreadDispatcher use EditorApplication.update instead of MonoBehaviour.Update.
// class EditorThreadDispatcher
// {
// static object gate = new object();
// static EditorThreadDispatcher instance;
//
// public static EditorThreadDispatcher Instance
// {
// get
// {
// // Activate EditorThreadDispatcher is dangerous, completely Lazy.
// lock (gate)
// {
// if (instance == null)
// {
// instance = new EditorThreadDispatcher();
// }
//
// return instance;
// }
// }
// }
//
// ThreadSafeQueueWorker editorQueueWorker = new ThreadSafeQueueWorker();
//
// EditorThreadDispatcher()
// {
// UnityEditor.EditorApplication.update += Update;
// }
//
// public void Enqueue(Action<object> action, object state)
// {
// editorQueueWorker.Enqueue(action, state);
// }
//
// public void UnsafeInvoke(Action action)
// {
// try
// {
// action();
// }
// catch (Exception ex)
// {
// Debug.LogException(ex);
// }
// }
//
// public void UnsafeInvoke<T>(Action<T> action, T state)
// {
// try
// {
// action(state);
// }
// catch (Exception ex)
// {
// Debug.LogException(ex);
// }
// }
//
// public void PseudoStartCoroutine(IEnumerator routine)
// {
// editorQueueWorker.Enqueue(_ => ConsumeEnumerator(routine), null);
// }
//
// void Update()
// {
// editorQueueWorker.ExecuteAll(x => Debug.LogException(x));
// }
//
// void ConsumeEnumerator(IEnumerator routine)
// {
// if (routine.MoveNext())
// {
// var current = routine.Current;
// if (current == null)
// {
// goto ENQUEUE;
// }
//
// var type = current.GetType();
// if (type == typeof(AsyncOperation))
// {
// var asyncOperation = (AsyncOperation)current;
// editorQueueWorker.Enqueue(_ => ConsumeEnumerator(UnwrapWaitAsyncOperation(asyncOperation, routine)), null);
// return;
// }
// else if (type == typeof(WaitForSeconds))
// {
// var waitForSeconds = (WaitForSeconds)current;
// var accessor = typeof(WaitForSeconds).GetField("m_Seconds", BindingFlags.Instance | BindingFlags.GetField | BindingFlags.NonPublic);
// var second = (float)accessor.GetValue(waitForSeconds);
// editorQueueWorker.Enqueue(_ => ConsumeEnumerator(UnwrapWaitForSeconds(second, routine)), null);
// return;
// }
// else if (type == typeof(Coroutine))
// {
// Debug.Log("Can't wait coroutine on UnityEditor");
// goto ENQUEUE;
// }
// #if SupportCustomYieldInstruction
// else if (current is IEnumerator)
// {
// var enumerator = (IEnumerator)current;
// editorQueueWorker.Enqueue(_ => ConsumeEnumerator(UnwrapEnumerator(enumerator, routine)), null);
// return;
// }
// #endif
//
// ENQUEUE:
// editorQueueWorker.Enqueue(_ => ConsumeEnumerator(routine), null); // next update
// }
// }
//
// IEnumerator UnwrapWaitAsyncOperation(AsyncOperation asyncOperation, IEnumerator continuation)
// {
// while (!asyncOperation.isDone)
// {
// yield return null;
// }
// ConsumeEnumerator(continuation);
// }
//
// IEnumerator UnwrapWaitForSeconds(float second, IEnumerator continuation)
// {
// var startTime = DateTimeOffset.UtcNow;
// while (true)
// {
// yield return null;
//
// var elapsed = (DateTimeOffset.UtcNow - startTime).TotalSeconds;
// if (elapsed >= second)
// {
// break;
// }
// };
// ConsumeEnumerator(continuation);
// }
//
// IEnumerator UnwrapEnumerator(IEnumerator enumerator, IEnumerator continuation)
// {
// while (enumerator.MoveNext())
// {
// yield return null;
// }
// ConsumeEnumerator(continuation);
// }
// }
//
// #endif
/// <summary>Dispatch Asyncrhonous action.</summary>
public static void Post(Action<object> action, object state)
{
#if UNITY_EDITOR
if (!ScenePlaybackDetector.IsPlaying) { EditorThreadDispatcher.Instance.Enqueue(action, state); return; }
if (!ScenePlaybackDetector.IsPlaying)
{
throw new InvalidOperationException("No main thread dispatcher in Edit Mode!");
//EditorThreadDispatcher.Instance.Enqueue(action, state);
//return;
}
#endif
@ -206,7 +211,12 @@ namespace UniRx
public static void Send(Action<object> action, object state)
{
#if UNITY_EDITOR
if (!ScenePlaybackDetector.IsPlaying) { EditorThreadDispatcher.Instance.Enqueue(action, state); return; }
if (!ScenePlaybackDetector.IsPlaying)
{
throw new InvalidOperationException("No main thread dispatcher in Edit Mode!");
// EditorThreadDispatcher.Instance.Enqueue(action, state);
// return;
}
#endif
if (mainThreadToken != null)
@ -234,7 +244,12 @@ namespace UniRx
public static void UnsafeSend(Action action)
{
#if UNITY_EDITOR
if (!ScenePlaybackDetector.IsPlaying) { EditorThreadDispatcher.Instance.UnsafeInvoke(action); return; }
if (!ScenePlaybackDetector.IsPlaying)
{
throw new InvalidOperationException("No main thread dispatcher in Edit Mode!");
// EditorThreadDispatcher.Instance.UnsafeInvoke(action);
// return;
}
#endif
try
@ -255,7 +270,12 @@ namespace UniRx
public static void UnsafeSend<T>(Action<T> action, T state)
{
#if UNITY_EDITOR
if (!ScenePlaybackDetector.IsPlaying) { EditorThreadDispatcher.Instance.UnsafeInvoke(action, state); return; }
if (!ScenePlaybackDetector.IsPlaying)
{
throw new InvalidOperationException("No main thread dispatcher in Edit Mode!");
// EditorThreadDispatcher.Instance.UnsafeInvoke(action, state);
// return;
}
#endif
try
@ -283,7 +303,12 @@ namespace UniRx
{
#if UNITY_EDITOR
// call from other thread
if (!ScenePlaybackDetector.IsPlaying) { EditorThreadDispatcher.Instance.PseudoStartCoroutine(routine); return; }
if (!ScenePlaybackDetector.IsPlaying)
{
throw new InvalidOperationException("No main thread dispatcher in Edit Mode!");
// EditorThreadDispatcher.Instance.PseudoStartCoroutine(routine);
// return;
}
#endif
var dispatcher = Instance;
@ -304,7 +329,12 @@ namespace UniRx
public static void StartUpdateMicroCoroutine(IEnumerator routine)
{
#if UNITY_EDITOR
if (!ScenePlaybackDetector.IsPlaying) { EditorThreadDispatcher.Instance.PseudoStartCoroutine(routine); return; }
if (!ScenePlaybackDetector.IsPlaying)
{
throw new InvalidOperationException("No main thread dispatcher in Edit Mode!");
// EditorThreadDispatcher.Instance.PseudoStartCoroutine(routine);
// return;
}
#endif
var dispatcher = Instance;
@ -317,7 +347,12 @@ namespace UniRx
public static void StartFixedUpdateMicroCoroutine(IEnumerator routine)
{
#if UNITY_EDITOR
if (!ScenePlaybackDetector.IsPlaying) { EditorThreadDispatcher.Instance.PseudoStartCoroutine(routine); return; }
if (!ScenePlaybackDetector.IsPlaying)
{
throw new InvalidOperationException("No main thread dispatcher in Edit Mode!");
// EditorThreadDispatcher.Instance.PseudoStartCoroutine(routine);
// return;
}
#endif
var dispatcher = Instance;
@ -330,7 +365,11 @@ namespace UniRx
public static void StartEndOfFrameMicroCoroutine(IEnumerator routine)
{
#if UNITY_EDITOR
if (!ScenePlaybackDetector.IsPlaying) { EditorThreadDispatcher.Instance.PseudoStartCoroutine(routine); return; }
if (!ScenePlaybackDetector.IsPlaying)
{
// EditorThreadDispatcher.Instance.PseudoStartCoroutine(routine);
// return;
}
#endif
var dispatcher = Instance;
@ -343,7 +382,12 @@ namespace UniRx
new public static Coroutine StartCoroutine(IEnumerator routine)
{
#if UNITY_EDITOR
if (!ScenePlaybackDetector.IsPlaying) { EditorThreadDispatcher.Instance.PseudoStartCoroutine(routine); return null; }
if (!ScenePlaybackDetector.IsPlaying)
{
throw new InvalidOperationException("No main thread dispatcher in Edit Mode!");
// EditorThreadDispatcher.Instance.PseudoStartCoroutine(routine);
// return null;
}
#endif
var dispatcher = Instance;

View file

@ -8986,7 +8986,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 8
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &677710706
GameObject:
@ -14030,7 +14030,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 9
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1019449643
MonoBehaviour:
@ -17950,102 +17950,6 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1505831356}
m_CullTransparentMesh: 0
--- !u!1 &1507049228
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1507049232}
- component: {fileID: 1507049231}
- component: {fileID: 1507049230}
- component: {fileID: 1507049229}
m_Layer: 0
m_Name: Quad
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!64 &1507049229
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1507049228}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 4
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &1507049230
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1507049228}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &1507049231
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1507049228}
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1507049232
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1507049228}
m_LocalRotation: {x: 0.16801846, y: -0, z: -0, w: 0.9857839}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 2.3802, y: 2.3802, z: 2.3802}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 19.345, y: 0, z: 0}
--- !u!1 &1523113324
GameObject:
m_ObjectHideFlags: 0
@ -23650,102 +23554,6 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2060887865}
m_CullTransparentMesh: 0
--- !u!1 &2075269400
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2075269404}
- component: {fileID: 2075269403}
- component: {fileID: 2075269402}
- component: {fileID: 2075269401}
m_Layer: 0
m_Name: GalaxyMap
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!64 &2075269401
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2075269400}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 4
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &2075269402
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2075269400}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 57000f7bd59643b4f9a5731dea6468ef, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &2075269403
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2075269400}
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &2075269404
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2075269400}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 6.4250393, y: 6.4250393, z: 6.4250393}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2095699056
GameObject:
m_ObjectHideFlags: 0

Binary file not shown.

View file

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 0fd26baea0cb27642a9e92eb0980ba95
guid: c0300fb6953b52548967234468a15850
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: acfc00ecc36adf147b1c3b2b6af3ca86
guid: 89920435286a77747af9ab9cf191ab24
DefaultImporter:
externalObjects: {}
userData:

File diff suppressed because it is too large Load diff

Binary file not shown.

View file

@ -151,11 +151,11 @@ RectTransform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 62236173}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -0.01}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1124877095}
m_RootOrder: 3
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -821,11 +821,11 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 162042368}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalPosition: {x: 0, y: 0.0125, z: 1}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1124877095}
m_RootOrder: 2
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!64 &162042370
MeshCollider:
@ -1185,7 +1185,7 @@ GameObject:
- component: {fileID: 441433740}
- component: {fileID: 441433739}
m_Layer: 0
m_Name: Background
m_Name: Secondary
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -1199,11 +1199,11 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 441433737}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0.02}
m_LocalPosition: {x: 0, y: 0, z: 4}
m_LocalScale: {x: 2, y: 2, z: 2}
m_Children: []
m_Father: {fileID: 1124877095}
m_RootOrder: 0
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!64 &441433739
MeshCollider:
@ -1527,7 +1527,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 507446966}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0.25}
m_LocalPosition: {x: 0, y: 0, z: 5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1183010124}
@ -2458,6 +2458,7 @@ Transform:
m_LocalPosition: {x: 0.25, y: 0.25, z: 0}
m_LocalScale: {x: 0.015, y: 0.015, z: 1}
m_Children:
- {fileID: 1520024706}
- {fileID: 441433738}
- {fileID: 1190354609}
- {fileID: 162042369}
@ -2489,7 +2490,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 2c8b54233e980c94096777e19a4e070a, type: 3}
m_Name:
m_EditorClassIdentifier:
Background: {fileID: 441433740}
Primary: {fileID: 1520024708}
Secondary: {fileID: 441433740}
Influence: {fileID: 1190354611}
Label: {fileID: 62236175}
--- !u!1 &1183010123
@ -2561,13 +2563,19 @@ MonoBehaviour:
ZonePrototype: {fileID: 1124877096}
LinkPrototype: {fileID: 1955533723}
IconPrototype: {fileID: 801092330}
ZonePrimaryMaterial: {fileID: 2100000, guid: 6c332e6d0be83ac459c05a7cf5b90ed1, type: 2}
ZoneSecondaryMaterial: {fileID: 2100000, guid: 76476d467e1cd844dacbcbe00105866e,
type: 2}
ZoneLinkMaterial: {fileID: 2100000, guid: a8d716e09aea7ce48a1220980f19b494, type: 2}
MegaPrimaryBoost: 0.75
MegaSecondaryBoost: 2
MegaLinkBoost: 2
EntranceIcon: {fileID: 2800000, guid: 9025249fbeb4b594680d2749b521bb41, type: 3}
ExitIcon: {fileID: 2800000, guid: cb18d00f3b884e24da71c10aa20a1a18, type: 3}
BossIcon: {fileID: 2800000, guid: 66887e71b9b25b94baa1da4bf12b490d, type: 3}
HomeIcon: {fileID: 2800000, guid: 6c9ab17a8574de140969db991b89994f, type: 3}
LegendPrototype: {fileID: 652433666}
IconDistance: 1
MegaColorBoost: 2.5
ZoneCount: 256
LinkDensity: 0.25
LabelDistance: 0.4
@ -2609,7 +2617,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchoredPosition: {x: 36, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1187011253
@ -2679,11 +2687,11 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1190354608}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0.02}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 15, y: 15, z: 1}
m_Children: []
m_Father: {fileID: 1124877095}
m_RootOrder: 1
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!64 &1190354610
MeshCollider:
@ -2783,7 +2791,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchoredPosition: {x: 108, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1236141029
@ -2908,7 +2916,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1388747984}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0.01}
m_LocalPosition: {x: 0, y: 0, z: 3}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1955533727}
@ -3033,8 +3041,8 @@ Camera:
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 2
near clip plane: 0.5
far clip plane: 20
field of view: 60
orthographic: 1
orthographic size: 1024
@ -3216,6 +3224,102 @@ MonoBehaviour:
positionOffset: {x: 0, y: 0, z: 0}
m_posOffsetData: {fileID: 0}
listenerMask: 1
--- !u!1 &1520024705
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1520024706}
- component: {fileID: 1520024709}
- component: {fileID: 1520024708}
- component: {fileID: 1520024707}
m_Layer: 0
m_Name: Primary
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1520024706
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1520024705}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 2}
m_LocalScale: {x: 0.87800574, y: 0.87800574, z: 1.7560115}
m_Children: []
m_Father: {fileID: 1124877095}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!64 &1520024707
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1520024705}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 4
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &1520024708
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1520024705}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 6c332e6d0be83ac459c05a7cf5b90ed1, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &1520024709
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1520024705}
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1 &1538186654
GameObject:
m_ObjectHideFlags: 0
@ -3912,7 +4016,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1955533722}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalPosition: {x: 0.25, y: 0.25, z: 0}
m_LocalScale: {x: 0.1, y: 0.002, z: 1}
m_Children: []
m_Father: {fileID: 1388747985}

View file

@ -135,7 +135,7 @@ public class ActionGameManager : MonoBehaviour
PlayerSettings = MessagePackSerializer.Deserialize<PlayerSettings>(
File.ReadAllBytes(playerSettingsFile.FullName));
Loadouts.AddRange(_loadoutPath.EnumerateFiles("*.preset")
Loadouts.AddRange(_loadoutPath.EnumerateFiles("*.loadout")
.Select(fi => MessagePackSerializer.Deserialize<EntityPack>(File.ReadAllBytes(fi.FullName))));
var names = new HashSet<string>();
@ -449,7 +449,7 @@ public class ActionGameManager : MonoBehaviour
radius: Settings.DefaultZoneRadius
);
Zone = new Zone(Settings.PlanetSettings, zonePack);
Zone = new Zone(ItemManager, Settings.PlanetSettings, zonePack);
Zone.Log = s => Debug.Log($"Zone: {s}");
if (CurrentEntity != null)
@ -468,7 +468,7 @@ public class ActionGameManager : MonoBehaviour
if (CurrentEntity != null)
{
DisposeEntityBinding();
UnbindEntity();
BindToEntity(CurrentEntity);
}
@ -477,50 +477,32 @@ public class ActionGameManager : MonoBehaviour
private void GenerateZoneEntities(Zone zone)
{
var testCorp = new MegaCorporation();
testCorp.Name = "TestCorp";
testCorp.PlayerHostile = true;
var stationType = ItemData.GetAll<HullData>().First(x=>x.HullType==HullType.Station);
var stationHull = ItemManager.CreateInstance(stationType) as EquippableItem;
var stationParent = Zone.PlanetInstances.Values.OrderByDescending(p => p.BodyData.Mass.Value).ElementAt(3);
var stationParentOrbit = stationParent.Orbit.Data.ID;
var stationParentPos = Zone.GetOrbitPosition(stationParentOrbit);
var stationPos = stationParentPos + ItemManager.Random.NextFloat2Direction() * stationParent.GravityWellRadius.Value * .1f;
var stationOrbit = Zone.CreateOrbit(stationParentOrbit, stationPos);
var station = new OrbitalEntity(ItemManager, Zone, stationHull, stationOrbit.ID);
//station.Faction = testCorp;
zone.Entities.Add(station);
var dockingBayData = ItemData.GetAll<DockingBayData>().First();
var dockingBay = ItemManager.CreateInstance(dockingBayData) as EquippableItem;
station.TryEquip(dockingBay);
station.Activate();
var turretLoadout = Loadouts.First(x => x.Name == "Turret");
for(int i=0; i<3; i++)
{
var planet = zone.PlanetInstances.Values.OrderByDescending(p => p.BodyData.Mass.Value).ElementAt(4+i);
var planetOrbit = planet.Orbit.Data.ID;
var planetPos = zone.GetOrbitPosition(planetOrbit);
for (int j = 0; j < 2; j++)
{
var pos = planetPos + ItemManager.Random.NextFloat2Direction() * planet.GravityWellRadius.Value * (.1f + .1f * j);
var orbit = zone.CreateOrbit(planetOrbit, pos);
var turret = EntityPack.Unpack(ItemManager, Zone, turretLoadout, orbit.ID, true);
turret.Activate();
turret.Name = $"Turret {i}-{(char) ('A' + j)}";
turret.Faction = testCorp;
zone.Entities.Add(turret);
}
}
var enemyShipLoadout = Loadouts.First(x => ((HullData) ItemManager.GetData(x.Hull)).HullType == HullType.Ship);
var enemyShip = EntityPack.Unpack(ItemManager, Zone, enemyShipLoadout, true);
enemyShip.Faction = testCorp;
enemyShip.Activate();
zone.Entities.Add(enemyShip);
zone.Agents.Add(CreateAgent(enemyShip));
//
// var turretLoadout = Loadouts.First(x => x.Name == "Turret");
//
// for(int i=0; i<3; i++)
// {
// var planet = zone.PlanetInstances.Values.OrderByDescending(p => p.BodyData.Mass.Value).ElementAt(4+i);
// var planetOrbit = planet.Orbit.Data.ID;
// var planetPos = zone.GetOrbitPosition(planetOrbit);
// for (int j = 0; j < 2; j++)
// {
// var pos = planetPos + ItemManager.Random.NextFloat2Direction() * planet.GravityWellRadius.Value * (.1f + .1f * j);
// var orbit = zone.CreateOrbit(planetOrbit, pos);
// var turret = EntityPack.Unpack(ItemManager, Zone, turretLoadout, orbit.ID, true);
// turret.Activate();
// turret.Name = $"Turret {i}-{(char) ('A' + j)}";
// turret.Faction = testCorp;
// zone.Entities.Add(turret);
// }
// }
//
// var enemyShipLoadout = Loadouts.First(x => ((HullData) ItemManager.GetData(x.Hull)).HullType == HullType.Ship);
// var enemyShip = EntityPack.Unpack(ItemManager, Zone, enemyShipLoadout, true);
// enemyShip.Faction = testCorp;
// enemyShip.Activate();
// zone.Entities.Add(enemyShip);
// zone.Agents.Add(CreateAgent(enemyShip));
}
private Agent CreateAgent(Ship ship)
@ -535,17 +517,31 @@ public class ActionGameManager : MonoBehaviour
private void StartGame()
{
GenerateLevel();
// var turret = Zone.Entities.First(e => e.Name.StartsWith("Turret"));
// BindToEntity(turret);
var ship = EntityPack.Unpack(ItemManager, Zone, Loadouts.First(x => x.Name == StarterShipTemplate), true);
ship.Zone = Zone;
Zone.Entities.Add(ship);
ship.Activate();
BindToEntity(ship);
ship.ExitWormhole(
SectorRenderer.WormholeInstances.Keys.First().Position,
ItemManager.Random.NextFloat2Direction() * Settings.GameplaySettings.WormholeExitVelocity);
EnterOverworld();
var stationType = ItemData.GetAll<HullData>().First(x=>x.HullType==HullType.Station);
var stationHull = ItemManager.CreateInstance(stationType) as EquippableItem;
var stationParent = Zone.PlanetInstances.Values.OrderByDescending(p => p.BodyData.Mass.Value).ElementAt(3);
var stationParentOrbit = stationParent.Orbit.Data.ID;
var stationParentPos = Zone.GetOrbitPosition(stationParentOrbit);
var stationPos = stationParentPos + ItemManager.Random.NextFloat2Direction() * stationParent.GravityWellRadius.Value * .1f;
var stationOrbit = Zone.CreateOrbit(stationParentOrbit, stationPos);
var station = new OrbitalEntity(ItemManager, Zone, stationHull, stationOrbit.ID);
Zone.Entities.Add(station);
var dockingBayData = ItemData.GetAll<DockingBayData>().First();
var dockingBay = ItemManager.CreateInstance(dockingBayData) as EquippableItem;
station.TryEquip(dockingBay);
station.Activate();
DoDock(station, station.DockingBays.First());
// var ship = EntityPack.Unpack(ItemManager, Zone, Loadouts.First(x => x.Name == StarterShipTemplate), true);
// ship.Zone = Zone;
// Zone.Entities.Add(ship);
// ship.Activate();
// BindToEntity(ship);
// ship.ExitWormhole(
// SectorRenderer.WormholeInstances.Keys.First().Position,
// ItemManager.Random.NextFloat2Direction() * Settings.GameplaySettings.WormholeExitVelocity);
}
public void Dock()
@ -561,18 +557,8 @@ public class ActionGameManager : MonoBehaviour
var bay = entity.TryDock(ship);
if (bay != null)
{
DisposeEntityBinding();
DockedEntity = entity;
SectorRenderer.PerspectiveEntity = DockedEntity;
DockingBay = bay;
DockCamera.enabled = true;
FollowCamera.enabled = false;
var orbital = (OrbitalEntity) entity;
DockCamera.Follow = SectorRenderer.EntityInstances[orbital].transform;
var parentOrbit = Zone.Orbits[orbital.OrbitData].Data.Parent;
var parentPlanet = SectorRenderer.Planets[Zone.Planets.FirstOrDefault(p => p.Value.Orbit == parentOrbit).Key];
DockCamera.LookAt = parentPlanet.Body.transform;
Menu.ShowTab(MenuTab.Inventory);
UnbindEntity();
DoDock(entity, bay);
AkSoundEngine.PostEvent("Dock", gameObject);
return;
}
@ -582,6 +568,21 @@ public class ActionGameManager : MonoBehaviour
AkSoundEngine.PostEvent("Dock_Fail", gameObject);
}
private void DoDock(Entity entity, EquippedDockingBay dockingBay)
{
DockedEntity = entity;
SectorRenderer.PerspectiveEntity = DockedEntity;
DockingBay = dockingBay;
DockCamera.enabled = true;
FollowCamera.enabled = false;
var orbital = (OrbitalEntity) entity;
DockCamera.Follow = SectorRenderer.EntityInstances[orbital].transform;
var parentOrbit = Zone.Orbits[orbital.OrbitData].Data.Parent;
var parentPlanet = SectorRenderer.Planets[Zone.Planets.FirstOrDefault(p => p.Value.Orbit == parentOrbit).Key];
DockCamera.LookAt = parentPlanet.Body.transform;
Menu.ShowTab(MenuTab.Inventory);
}
public void Undock()
{
if (CurrentEntity.Parent == null) return;
@ -611,8 +612,6 @@ public class ActionGameManager : MonoBehaviour
else if (CurrentEntity.Parent.TryUndock(ship))
{
BindToEntity(ship);
EnterOverworld();
AkSoundEngine.PostEvent("Undock", gameObject);
}
else
@ -624,7 +623,7 @@ public class ActionGameManager : MonoBehaviour
}
}
private void DisposeEntityBinding()
private void UnbindEntity()
{
foreach (var indicator in _visibleHostileIndicators)
{
@ -642,8 +641,18 @@ public class ActionGameManager : MonoBehaviour
_shipSubscriptions.Clear();
}
private void EnterOverworld()
private void BindToEntity(Entity entity)
{
if (!SectorRenderer.EntityInstances.ContainsKey(entity))
{
Debug.LogError($"Attempted to bind to entity {entity.Name}, but SectorRenderer has no such instance!");
return;
}
CurrentEntity = entity;
DeathPP.weight = 0;
SectorRenderer.PerspectiveEntity = CurrentEntity;
Menu.gameObject.SetActive(false);
DockedEntity = null;
DockingBay = null;
@ -655,17 +664,6 @@ public class ActionGameManager : MonoBehaviour
_input.Player.Enable();
ShipPanel.Display(CurrentEntity, true);
SchematicDisplay.ShowShip(CurrentEntity);
}
private void BindToEntity(Entity entity)
{
if (!SectorRenderer.EntityInstances.ContainsKey(entity))
{
Debug.LogError($"Attempted to bind to entity {entity.Name}, but SectorRenderer has no such instance!");
return;
}
CurrentEntity = entity;
SectorRenderer.PerspectiveEntity = CurrentEntity;
FollowCamera.LookAt = SectorRenderer.EntityInstances[CurrentEntity].LookAtPoint;
FollowCamera.Follow = SectorRenderer.EntityInstances[CurrentEntity].transform;
@ -717,7 +715,7 @@ public class ActionGameManager : MonoBehaviour
_shipSubscriptions.Add(CurrentEntity.Death.Subscribe(_ =>
{
var deathTime = Time.time;
DisposeEntityBinding();
UnbindEntity();
CurrentEntity = null;
ConfirmationDialog.Clear();
ConfirmationDialog.Title.text = "You have died!";

View file

@ -0,0 +1,46 @@
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class MainMenu : MonoBehaviour
{
public TextMeshProUGUI Title;
public Prototype ButtonPrototype;
private List<Prototype> _contents = new List<Prototype>();
void Start()
{
ShowMain();
}
private void ShowMain()
{
Title.text = "aetheria\n<smallcaps><size=50%>terminus";
Clear();
AddButton("Continue", null);
AddButton("New Game", null);
AddButton("Load Game", null);
AddButton("Settings", null);
AddButton("Quit", Application.Quit);
}
private void Clear()
{
foreach(var item in _contents)
item.ReturnToPool();
_contents.Clear();
}
private void AddButton(string label, Action onPress)
{
var button = ButtonPrototype.Instantiate<Button>();
button.GetComponent<TextMeshProUGUI>().text = label;
button.onClick.RemoveAllListeners();
button.onClick.AddListener(() => onPress?.Invoke());
_contents.Add(button.GetComponent<Prototype>());
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3d7c7b928d043a3449b93bce9de03d1c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -16,58 +16,13 @@ using static Unity.Mathematics.noise;
[RequireComponent( typeof( Camera ) ), ImageEffectAllowedInSceneView]
public class VolumeSampling : MonoBehaviour
{
// public int Octaves = 4;
// public float Frequency = 1;
// public float Lacunarity = 2;
// public float Gain = .5f;
// public int NoiseTextureCount = 16;
// public int NoiseTextureSize = 32;
public Material _volMaterial;
public Transform GridTransform;
private Camera _camera;
// private Texture3D[] _noiseTextures;
// private int _currentNoiseTexture;
private void Start()
{
_camera = GetComponent<Camera>();
// _noiseTextures = new Texture3D[NoiseTextureCount];
// var samples = new Color[NoiseTextureSize * NoiseTextureSize * NoiseTextureSize];
// for (int i = 0; i < NoiseTextureCount; i++)
// {
// var iv = (float) i / NoiseTextureCount;
// var tex = new Texture3D(NoiseTextureSize,NoiseTextureSize,NoiseTextureSize, GraphicsFormat.R8_UNorm, TextureCreationFlags.None);
// tex.filterMode = FilterMode.Bilinear;
// for (int z = 0; z < NoiseTextureSize; z++)
// {
// var zf = (float) z / NoiseTextureSize;
// int zOffset = z * NoiseTextureSize * NoiseTextureSize;
// for (int y = 0; y < NoiseTextureSize; y++)
// {
// var yf = (float) y / NoiseTextureSize;
// int yOffset = y * NoiseTextureSize;
// for (int x = 0; x < NoiseTextureSize; x++)
// {
// var xf = (float) x / NoiseTextureSize;
// var index = x + yOffset + zOffset;
// float freq = Frequency, amp = 1;
// float sum = 0;
// var p = float4(xf, yf, zf, iv);
// for(int o = 0; o < Octaves; o++)
// {
// sum += (pnoise(p * freq, 1 / freq) + 1) / 2 * amp;
// freq *= Lacunarity;
// amp *= Gain;
// }
//
// samples[index] = Color.white * sum;
// }
// }
// }
// tex.SetPixels(samples);
// tex.Apply();
// _noiseTextures[i] = tex;
// }
}
[ImageEffectOpaque]
@ -79,10 +34,6 @@ public class VolumeSampling : MonoBehaviour
Graphics.Blit(source, destination);
return;
}
// _currentNoiseTexture = (_currentNoiseTexture + 1) % NoiseTextureCount;
//
// _volMaterial.SetTexture("_NoiseTex", _noiseTextures[_currentNoiseTexture]);
// Shader needs this matrix to generate world space rays
_volMaterial.SetMatrix("_CamProj", (_camera.projectionMatrix * _camera.worldToCameraMatrix).inverse);

View file

@ -5,19 +5,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using JsonKnownTypes;
using MessagePack;
using Newtonsoft.Json;
using UniRx;
using Unity.Mathematics;
using static Unity.Mathematics.math;
using int2 = Unity.Mathematics.int2;
[MessagePackObject,
Union(0, typeof(Ship)),
Union(1, typeof(OrbitalEntity)),
JsonObject(MemberSerialization.OptIn), JsonConverter(typeof(JsonKnownTypesConverter<Entity>))]
public abstract class Entity
{
public Zone Zone;

View file

@ -6,53 +6,15 @@ using MessagePack;
using RethinkDb.Driver.Ast;
using Unity.Mathematics;
[MessagePackObject]
public class EntityPack
public static class EntitySerializer
{
[Key(0)]
public string Name;
[Key(1)]
public EquippableItem Hull;
[Key(2)]
public (int2 position, EquippableItem item)[] Equipment;
[Key(3)]
public (int2 position, EquippableItem item)[] CargoBays;
[Key(4)]
public (int2 position, EquippableItem item)[] DockingBays;
[Key(5)]
public Dictionary<int2, PersistentBehaviorData[]> PersistedBehaviors;
[Key(6)]
public float[,] Temperature;
[Key(7)]
public float[,] Armor;
[Key(8)]
public bool2[,] Conductivity;
[Key(10)]
public int[] DockingBayAssignments;
[Key(11)]
public (int2 position, ItemInstance item)[][] CargoContents;
[Key(12)]
public (int2 position, ItemInstance item)[][] DockingBayContents;
[Key(13)]
public EntityPack[] Children;
private int _price;
public static EntityPack Pack(Entity entity)
{
var pack = new EntityPack();
EntityPack pack;
if (entity is OrbitalEntity orbital)
pack = new OrbitalEntityPack {Orbit = orbital.OrbitData};
else pack = new ShipPack();
// Filter item behavior collections by those with any persistent behaviors
// For each item create an object containing the item position and a list of persistent behaviors
@ -80,16 +42,27 @@ public class EntityPack
return pack;
}
public static Ship Unpack(ItemManager itemManager, Zone zone, EntityPack pack, bool instantiate = false)
public static Entity Unpack(ItemManager itemManager, Zone zone, EntityPack pack, bool instantiate = false)
{
return pack switch
{
ShipPack shipPack => Unpack(itemManager, zone, shipPack, instantiate),
OrbitalEntityPack orbitalEntityPack => Unpack(itemManager, zone, orbitalEntityPack, instantiate),
_ => null
};
}
public static Ship Unpack(ItemManager itemManager, Zone zone, ShipPack pack, bool instantiate = false)
{
var entity = new Ship(itemManager, zone, instantiate ? (EquippableItem) itemManager.Instantiate(pack.Hull) : pack.Hull);
Restore(itemManager, zone, pack, entity, instantiate);
return entity;
}
public static OrbitalEntity Unpack(ItemManager itemManager, Zone zone, EntityPack pack, Guid orbit, bool instantiate = false)
public static OrbitalEntity Unpack(ItemManager itemManager, Zone zone, OrbitalEntityPack pack, bool instantiate = false)
{
var entity = new OrbitalEntity(itemManager, zone, instantiate ? (EquippableItem) itemManager.Instantiate(pack.Hull) : pack.Hull, orbit);
var entity = new OrbitalEntity(itemManager, zone, instantiate ? (EquippableItem) itemManager.Instantiate(pack.Hull) : pack.Hull, pack.Orbit);
Restore(itemManager, zone, pack, entity, instantiate);
return entity;
}
@ -144,6 +117,63 @@ public class EntityPack
foreach(var v in hullData.Shape.Coordinates)
entity.HullConductivity[v.x,v.y] = pack.Conductivity[v.x,v.y];
}
}
[MessagePackObject]
public class ShipPack : EntityPack { }
[MessagePackObject]
public class OrbitalEntityPack : EntityPack
{
[Key(14)]
public Guid Orbit;
}
[MessagePackObject,
Union(0, typeof(OrbitalEntityPack)),
Union(1, typeof(ShipPack))]
public class EntityPack
{
[Key(0)]
public string Name;
[Key(1)]
public EquippableItem Hull;
[Key(2)]
public (int2 position, EquippableItem item)[] Equipment;
[Key(3)]
public (int2 position, EquippableItem item)[] CargoBays;
[Key(4)]
public (int2 position, EquippableItem item)[] DockingBays;
[Key(5)]
public Dictionary<int2, PersistentBehaviorData[]> PersistedBehaviors;
[Key(6)]
public float[,] Temperature;
[Key(7)]
public float[,] Armor;
[Key(8)]
public bool2[,] Conductivity;
[Key(10)]
public int[] DockingBayAssignments;
[Key(11)]
public (int2 position, ItemInstance item)[][] CargoContents;
[Key(12)]
public (int2 position, ItemInstance item)[][] DockingBayContents;
[Key(13)]
public EntityPack[] Children;
private int _price;
public int Price(ItemManager itemManager)
{

View file

@ -30,12 +30,34 @@ public static class Extensions
peer.Send(MessagePackSerializer.Serialize(message as Message), method);
}
// public static float Performance(this EquippableItemData itemData, float temperature)
// {
// return saturate(itemData.HeatPerformanceCurve.Evaluate(saturate(
// (temperature - itemData.MinimumTemperature) /
// (itemData.MaximumTemperature - itemData.MinimumTemperature))));
// }
public static T[] WeightedRandomElements<T>(this IEnumerable<T> collection, ref Random random, Func<T, float> weightFunction, int count)
{
var weights = new Dictionary<T, float>(collection.Count());
var totalWeight = 0f;
foreach (var x in collection)
{
weights[x] = weightFunction(x);
totalWeight += weights[x];
}
var elements = new T[count];
for (int i = 0; i < count; i++)
{
var targetWeight = random.NextFloat(totalWeight);
var accumWeight = 0f;
foreach (var x in collection)
{
accumWeight += weights[x];
if (accumWeight > targetWeight)
{
elements[i] = x;
break;
}
}
}
return elements;
}
// Thanks, https://stackoverflow.com/a/48599119
public static bool ByteArrayCompare(ReadOnlySpan<byte> a1, ReadOnlySpan<byte> a2)

View file

@ -29,6 +29,7 @@ public class Zone
private HashSet<Guid> _updatedOrbits = new HashSet<Guid>();
private ItemManager _itemManager;
private float _time;
private Random _random;
public List<Agent> Agents = new List<Agent>();
@ -36,8 +37,9 @@ public class Zone
public ZoneData Data { get; }
private List<Task> BeltUpdates = new List<Task>();
public Zone(PlanetSettings settings, ZonePack pack)
public Zone(ItemManager itemManager, PlanetSettings settings, ZonePack pack)
{
_itemManager = itemManager;
Data = pack.Data;
Settings = settings;
_random = new Random(Convert.ToUInt32(abs(Data.ID.GetHashCode())));
@ -63,8 +65,11 @@ public class Zone
break;
}
}
foreach (var entity in pack.Entities) Entities.Add(entity);
foreach (var entity in pack.Entities)
{
Entities.Add(EntitySerializer.Unpack(_itemManager, this, entity));
}
// TODO: Associate planets with stored entities for planetary colonies
}
@ -74,7 +79,7 @@ public class Zone
return new ZonePack
{
Data = Data,
//Entities = Entities.ToList(),
Entities = Entities.Select(EntitySerializer.Pack).ToList(),
Orbits = Orbits.Values.Select(o=>o.Data).ToList(),
Planets = Planets.Values.ToList()
};

View file

@ -60,7 +60,7 @@ public class ZonePack : INamedEntry
public List<OrbitData> Orbits = new List<OrbitData>();
[JsonProperty("entities"), Key(3)]
public List<Entity> Entities = new List<Entity>();
public List<EntityPack> Entities = new List<EntityPack>();
[IgnoreMember] public string EntryName
{

View file

@ -145,7 +145,7 @@ public class InventoryPanel : MonoBehaviour, IPointerClickHandler
ContextMenu.AddOption("Save Loadout",
() =>
{
GameManager.SaveLoadout(EntityPack.Pack(_displayedEntity));
GameManager.SaveLoadout(EntitySerializer.Pack(_displayedEntity));
});
if (GameManager.Loadouts.Any())
@ -155,13 +155,16 @@ public class InventoryPanel : MonoBehaviour, IPointerClickHandler
(
$"{pack.Name} - {pack.Price(GameManager.ItemManager):n0}", () =>
{
var ship = EntityPack.Unpack(GameManager.ItemManager, GameManager.Zone, pack, true);
ship.SetParent(GameManager.DockedEntity);
GameManager.PlayerEntities.Add(ship);
var entity = EntitySerializer.Unpack(GameManager.ItemManager, GameManager.Zone, pack, true);
entity.SetParent(GameManager.DockedEntity);
GameManager.PlayerEntities.Add(entity);
GameManager.Credits -= pack.Price(GameManager.ItemManager);
GameManager.CurrentEntity = ship;
GameManager.DockingBay.DockedShip = ship;
Display(ship);
GameManager.CurrentEntity = entity;
if(entity is Ship ship)
{
GameManager.DockingBay.DockedShip = ship;
}
Display(entity);
}, pack.Price(GameManager.ItemManager) < GameManager.Credits
)));
}

View file

@ -20,18 +20,24 @@ public class SectorMap : MonoBehaviour
public Prototype ZonePrototype;
public Prototype LinkPrototype;
public Prototype IconPrototype;
public Material ZonePrimaryMaterial;
public Material ZoneSecondaryMaterial;
public Material ZoneLinkMaterial;
public float MegaPrimaryBoost = .75f;
public float MegaSecondaryBoost = 2f;
public float MegaLinkBoost = 2f;
public Texture2D EntranceIcon;
public Texture2D ExitIcon;
public Texture2D BossIcon;
public Texture2D HomeIcon;
public Prototype LegendPrototype;
public float IconDistance = 1;
public float MegaColorBoost = 2.5f;
public int ZoneCount = 64;
public float LinkDensity = .5f;
public float LabelDistance = .4f;
private RenderTexture[] _influenceTextures;
private Dictionary<MegaCorporation, (RenderTexture influence, Material primaryMaterial, Material secondaryMaterial, Material linkMaterial)> _factionMaterials =
new Dictionary<MegaCorporation, (RenderTexture influence, Material primaryMaterial, Material secondaryMaterial, Material linkMaterial)>();
void Start()
{
@ -45,6 +51,13 @@ public class SectorMap : MonoBehaviour
var sectorMegas = megas.OrderBy(x => Random.value).Take(Settings.MegaCount).ToArray();
foreach (var mega in sectorMegas)
{
var primary = Instantiate(ZonePrimaryMaterial);
primary.SetColor("_TintColor", (mega.PrimaryColor * MegaPrimaryBoost).ToColor());
var secondary = Instantiate(ZoneSecondaryMaterial);
secondary.SetColor("_TintColor", (mega.SecondaryColor * MegaSecondaryBoost).ToColor());
var link = Instantiate(ZoneLinkMaterial);
link.SetColor("_TintColor", (mega.PrimaryColor * MegaLinkBoost).ToColor());
_factionMaterials.Add(mega, (new RenderTexture(1024, 1024, 1, RenderTextureFormat.RHalf), primary, secondary, link));
mega.NameGenerator = new MarkovNameGenerator(ref random, UnityHelpers.LoadAsset<TextAsset>(mega.GeonameFile).text, Settings);
var legendElement = LegendPrototype.Instantiate<LegendElement>();
legendElement.Primary.color = mega.PrimaryColor.ToColor();
@ -56,6 +69,7 @@ public class SectorMap : MonoBehaviour
var sector = SectorGenerator.GenerateSector(Settings, sectorMegas, ref random);
var visitedZones = new HashSet<SectorZone>();
Debug.Log($"Found {sector.Zones.Count(z=>!z.AdjacentZones.Any())} orphaned zones!");
var zoneInstances = new Dictionary<SectorZone, SectorZoneUI>();
foreach (var zone in sector.Zones)
{
@ -64,7 +78,10 @@ public class SectorMap : MonoBehaviour
var zoneInstanceTransform = zoneInstance.transform;
zoneInstanceTransform.localPosition = new Vector3(zone.Position.x, zone.Position.y);
if(zone.Owner != null)
zoneInstance.Background.material.SetColor("_TintColor", zone.Owner.PrimaryColor.ToColor() * MegaColorBoost);
{
zoneInstance.Primary.sharedMaterial = _factionMaterials[zone.Owner].primaryMaterial;
zoneInstance.Secondary.sharedMaterial = _factionMaterials[zone.Owner].secondaryMaterial;
}
//zoneInstance.Background.transform.localScale = Vector3.one * (sector.HomeZones.Values.Any(os=>os==zone) ? 4 : 2);
var linkDirection = float2.zero;
foreach (var link in zone.AdjacentZones)
@ -76,10 +93,8 @@ public class SectorMap : MonoBehaviour
var pos = (zone.Position + link.Position) / 2;
linkInstance.localPosition = new Vector3(pos.x, pos.y);
if (zone.Owner != null && zone.Owner == link.Owner)
{
linkInstance.GetComponent<MeshRenderer>().material.SetColor("_TintColor", zone.Owner.PrimaryColor.ToColor());
}
linkInstance.GetComponent<MeshRenderer>().sharedMaterial = _factionMaterials[zone.Owner].linkMaterial;
var localScale = linkInstance.localScale;
localScale = new Vector3(length(zone.Position - link.Position), localScale.y, localScale.z);
linkInstance.localScale = localScale;
@ -145,10 +160,8 @@ public class SectorMap : MonoBehaviour
}
// Render Influence Textures
_influenceTextures = new RenderTexture[sectorMegas.Length];
for (var i = 0; i < sectorMegas.Length; i++)
foreach (var mega in sectorMegas)
{
_influenceTextures[i] = new RenderTexture(1024, 1024, 1, RenderTextureFormat.RHalf);
var influenceRenderer = InfluenceRendererPrototype.Instantiate<MeshRenderer>();
foreach (var zone in sector.Zones)
{
@ -156,10 +169,10 @@ public class SectorMap : MonoBehaviour
var influence = 0f;
if (zone.Megas.Length > 0)
{
if (zone.Megas.Contains(sectorMegas[i]))
if (zone.Megas.Contains(mega))
{
influence = 10;
if (zone.Owner != sectorMegas[i])
if (zone.Owner != mega)
influence *= .5f;
}
else influence = -10;
@ -167,12 +180,12 @@ public class SectorMap : MonoBehaviour
instance.Influence.material.SetFloat("_Depth", influence);
}
InfluenceCamera.targetTexture = _influenceTextures[i];
InfluenceCamera.targetTexture = _factionMaterials[mega].influence;
InfluenceCamera.Render();
influenceRenderer.material.mainTexture = _influenceTextures[i];
influenceRenderer.material.SetColor("_Color1", sectorMegas[i].PrimaryColor.ToColor());
influenceRenderer.material.SetColor("_Color2", sectorMegas[i].SecondaryColor.ToColor());
influenceRenderer.material.mainTexture = _factionMaterials[mega].influence;
influenceRenderer.material.SetColor("_Color1", mega.PrimaryColor.ToColor());
influenceRenderer.material.SetColor("_Color2", mega.SecondaryColor.ToColor());
influenceRenderer.material.SetFloat("_FillTilt", random.NextFloat(PI));
}
}

View file

@ -6,7 +6,8 @@ using UnityEngine.UI;
public class SectorZoneUI : MonoBehaviour
{
public MeshRenderer Background;
public MeshRenderer Primary;
public MeshRenderer Secondary;
public MeshRenderer Influence;
public TextMeshPro Label;
}

View file

@ -68,13 +68,6 @@ Shader "Aetheria/Influence"
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
return o;
}
float2 calcGrad (float2 uv, float me)
{
float n = -tex2D(_MainTex, float2(uv.x, uv.y + _MainTex_TexelSize.y)).x;
float e = -tex2D(_MainTex, float2(uv.x + _MainTex_TexelSize.x, uv.y)).x;
return float2(e-me,n-me);
}
fixed4 frag (v2f i) : SV_Target
{
@ -82,8 +75,6 @@ Shader "Aetheria/Influence"
float influence = tex2D(_MainTex, i.uv).r;
// Calculate gradient and rate of change of influence
//float2 grad = calcGrad(i.uv, influence);
//float diff = length(grad);
float2 grad = float2(ddx(influence), ddy(influence));
float diff = length(grad);

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -84,7 +84,7 @@
"depth": 0,
"source": "registry",
"dependencies": {
"com.unity.timeline": "1.2.6"
"com.unity.timeline": "1.2.17"
},
"url": "https://packages.unity.com"
},

BIN
UserSettings/EditorUserSettings.asset (Stored with Git LFS)

Binary file not shown.