diff --git a/Assets/Game.unity b/Assets/Game.unity index 25fde49..603b70c 100644 --- a/Assets/Game.unity +++ b/Assets/Game.unity @@ -520,7 +520,7 @@ MonoBehaviour: ScoreCenter: {fileID: 1241284409} Lost: 0 GameOver: {fileID: 1444885959} - Title: {fileID: 802837269} + Title: {fileID: 889690357} RestartBtn: {fileID: 289241848} StartBtn: {fileID: 787871392} PlayerPrefab: {fileID: 1487220595160186, guid: de0cf47d47318e94483f1669ea325fe5, @@ -593,7 +593,7 @@ RectTransform: m_LocalPosition: {x: 347.5, y: 298.5, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - - {fileID: 802837268} + - {fileID: 889690356} - {fileID: 1328003669} - {fileID: 1987698361} - {fileID: 99839167} @@ -683,80 +683,73 @@ CanvasRenderer: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 787871390} ---- !u!1 &802837267 +--- !u!1 &889690355 GameObject: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} serializedVersion: 5 m_Component: - - component: {fileID: 802837268} - - component: {fileID: 802837270} - - component: {fileID: 802837269} + - component: {fileID: 889690356} + - component: {fileID: 889690358} + - component: {fileID: 889690357} m_Layer: 0 - m_Name: Title + m_Name: TitleImage m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!224 &802837268 +--- !u!224 &889690356 RectTransform: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 802837267} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 174, z: 0} - m_LocalScale: {x: 0.49999997, y: 0.5, z: 0.5} + m_GameObject: {fileID: 889690355} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 189, z: 0} + m_LocalScale: {x: 0.5, y: 0.5, z: 0.5} m_Children: [] m_Father: {fileID: 747117607} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0, y: 174} - m_SizeDelta: {x: 697.8, y: 1085.5} + m_AnchoredPosition: {x: 0, y: 189} + m_SizeDelta: {x: 670, y: 67} m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &802837269 +--- !u!114 &889690357 MonoBehaviour: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 802837267} + m_GameObject: {fileID: 889690355} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Script: {fileID: -98529514, guid: f70555f144d8491a825f0804e09c671c, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - m_FontData: - m_Font: {fileID: 12800000, guid: 04a842e316b6f44bf8da702de26a8ed6, type: 3} - m_FontSize: 45 - m_FontStyle: 0 - m_BestFit: 1 - m_MinSize: 4 - m_MaxSize: 300 - m_Alignment: 4 - m_AlignByGeometry: 0 - m_RichText: 1 - m_HorizontalOverflow: 0 - m_VerticalOverflow: 0 - m_LineSpacing: 1 - m_Text: NEON SKYLINES ---- !u!222 &802837270 + m_Texture: {fileID: 2800000, guid: c32b5e23bb054254f9d1a8637f36aac3, type: 3} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 +--- !u!222 &889690358 CanvasRenderer: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 802837267} + m_GameObject: {fileID: 889690355} --- !u!1 &1036811556 GameObject: m_ObjectHideFlags: 0 @@ -845,7 +838,7 @@ AudioSource: serializedVersion: 4 OutputAudioMixerGroup: {fileID: 0} m_audioClip: {fileID: 8300000, guid: 649e4aa8ec6dc36409789a1a233bc387, type: 3} - m_PlayOnAwake: 1 + m_PlayOnAwake: 0 m_Volume: 0.605 m_Pitch: 1 Loop: 1 @@ -1059,7 +1052,7 @@ ParticleSystem: moveWithTransform: 0 moveWithCustomTransform: {fileID: 0} scalingMode: 1 - randomSeed: 1480670832 + randomSeed: -1789946895 InitialModule: serializedVersion: 3 enabled: 1 @@ -4656,6 +4649,34 @@ CanvasRenderer: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1328003668} +--- !u!1 &1329095920 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1329095921} + m_Layer: 0 + m_Name: Debris + m_TagString: Debris + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1329095921 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1329095920} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 9 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1444885957 GameObject: m_ObjectHideFlags: 0 @@ -4777,7 +4798,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Color: {r: 1, g: 1, b: 1, a: 0} m_RaycastTarget: 1 m_OnCullStateChanged: m_PersistentCalls: diff --git a/Assets/Generation/Chunk.cs b/Assets/Generation/Chunk.cs index a082a81..2fa96cd 100644 --- a/Assets/Generation/Chunk.cs +++ b/Assets/Generation/Chunk.cs @@ -105,7 +105,7 @@ public void Build() _mesh.SetNormals (BlockData.Normals); _mesh.SetColors (BlockData.Colors); _mesh.SetIndices (BlockData.Indices.ToArray (), MeshTopology.Triangles, 0); - this.GetComponent ().sharedMesh = _mesh; + //this.GetComponent ().sharedMesh = _mesh; }); } diff --git a/Assets/Generation/ChunkLoader.cs b/Assets/Generation/ChunkLoader.cs index 72d8532..2dfd9ae 100644 --- a/Assets/Generation/ChunkLoader.cs +++ b/Assets/Generation/ChunkLoader.cs @@ -82,7 +82,8 @@ private IEnumerator LoadChunks() if(Stop) break; - if (!Enabled || World.Discard) + + if (!Enabled) goto SLEEP; Offset = World.ToChunkSpace(_playerPosition); @@ -92,25 +93,26 @@ private IEnumerator LoadChunks() if (Offset != _lastOffset) { - + for (int _x = -GraphicsOptions.ChunkLoaderRadius / 2; _x < GraphicsOptions.ChunkLoaderRadius / 2; _x++) { for (int _z = -GraphicsOptions.ChunkLoaderRadius / 2; _z < GraphicsOptions.ChunkLoaderRadius / 2; _z++) { - for (int _y = -2; _y < 2; _y++) + for (int _y = -4; _y < 4; _y++) { int x = _x, y = _y ,z = _z; if (World.GetChunkByOffset(Offset + Vector3.Scale(new Vector3(x, y, z), new Vector3(Chunk.ChunkSize, Chunk.ChunkSize, Chunk.ChunkSize)) ) == null) { - Vector3 chunkPos = Offset + Vector3.Scale(new Vector3(x, y, z), new Vector3(Chunk.ChunkSize, Chunk.ChunkSize, Chunk.ChunkSize)); GameObject NewChunk = new GameObject("Chunk "+ (chunkPos.x) + " "+ (chunkPos.y) + " "+ (chunkPos.z) ); NewChunk.transform.position = chunkPos; NewChunk.transform.SetParent(World.gameObject.transform); NewChunk.AddComponent(); - NewChunk.AddComponent(); NewChunk.AddComponent (); + MeshRenderer Renderer = NewChunk.AddComponent(); + Renderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off; + Renderer.receiveShadows = false; Chunk chunk = NewChunk.AddComponent(); chunk.Init(chunkPos, World); World.AddChunk(chunkPos, chunk); @@ -144,10 +146,10 @@ private IEnumerator ManageChunksMesh() Chunks = World.Chunks.Values.ToList().ToArray(); } yield return null; - _left += 0.25f; + //_left += 0.25f; - if (_left >= 1.5f) - { + //if (_left >= 1.5f) + //{ _activeChunks = 0; for (int i = Chunks.Length - 1; i > -1; i--) { @@ -185,14 +187,12 @@ private IEnumerator ManageChunksMesh() if (Chunks[i] != null && Chunks[i].IsGenerated && !World.ContainsMeshQueue(Chunks[i]) && Chunks[i].ShouldBuild) { - yield return null; - World.AddToQueue(Chunks[i], true); } } - _left = 0f; - } + // _left = 0f; + //} if (_activeChunks != _prevChunkCount) { _prevChunkCount = _activeChunks; diff --git a/Assets/Generation/GenerationQueue.cs b/Assets/Generation/GenerationQueue.cs index fa2e308..514835f 100644 Binary files a/Assets/Generation/GenerationQueue.cs and b/Assets/Generation/GenerationQueue.cs differ diff --git a/Assets/Generation/GenerationThread.cs b/Assets/Generation/GenerationThread.cs deleted file mode 100644 index e94673b..0000000 --- a/Assets/Generation/GenerationThread.cs +++ /dev/null @@ -1,61 +0,0 @@ -/* Copyright (C) Luaek - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited - * Proprietary and confidential - * Written by Maxi Levi , November 2017 - */ - -using System; -using System.Threading; -using UnityEngine; - -namespace Assets.Generation -{ - /// - /// Description of GenerationThread. - /// - public class GenerationThread - { - public Thread WorkingThread; - public bool IsWorking{ get; set;} - private GenerationQueue _queue; - - public Chunk CurrentChunk = null; - public GenerationThread(GenerationQueue _queue) - { - this._queue = _queue; - this.IsWorking = false; - this.WorkingThread = new Thread(Start); - this.WorkingThread.IsBackground = true; - this.WorkingThread.Start(); - - } - - public void Generate(Chunk c){ - IsWorking = true; - CurrentChunk = c; - - } - - public void Start(){ - try{ - while(true){ - if(_queue.Stop) break; - - ThreadManager.Sleep(GenerationQueue.ThreadTime * GenerationQueue.ThreadCount); - if(CurrentChunk != null && !CurrentChunk.Disposed){ - - if(!CurrentChunk.IsGenerated){ - if(CurrentChunk != null) CurrentChunk.Generate(); - } - CurrentChunk = null; - IsWorking = false; - } - CurrentChunk = null; - IsWorking = false; - } - }catch(Exception e){ - Debug.Log(e.ToString()); - } - } - } -} diff --git a/Assets/Generation/GenerationThread.cs.meta b/Assets/Generation/GenerationThread.cs.meta deleted file mode 100644 index 32c1620..0000000 --- a/Assets/Generation/GenerationThread.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: c67ab5178d5d4ae4e8c0c0c06f7d7c07 -timeCreated: 1509843919 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Generation/MeshQueue.cs b/Assets/Generation/MeshQueue.cs index 4e3ce15..03b709e 100644 --- a/Assets/Generation/MeshQueue.cs +++ b/Assets/Generation/MeshQueue.cs @@ -19,73 +19,42 @@ namespace Assets.Generation public class MeshQueue { public GameObject _player; - public const int SleepTime = 5; - public const int ThreadCount = 1; + public const int SleepTime = 1; + public const int ThreadCount = 2; public List Queue = new List(); public bool Stop {get; set;} private World _world; private ClosestChunk _closestChunkComparer = new ClosestChunk(); public MeshQueue(World World){ - Thread[] Threads = new Thread[ThreadCount]; - for(int i = 0; i < ThreadCount; i++){ - Threads[i] = new Thread(Start); - Threads[i].IsBackground = true; - Threads[i].Start(); - } + //new Thread (Start).Start (); this._player = World.Player; this._world = World; } public bool Contains(Chunk ChunkToCheck){ - lock(Queue) - return Queue.Contains(ChunkToCheck); + return Queue.Contains(ChunkToCheck); } public void Add(Chunk ChunkToBuild){ - lock(Queue){ - if(!Queue.Contains(ChunkToBuild)) - Queue.Add(ChunkToBuild); - } - } - public bool Discard; - public void SafeDiscard(){ - Discard = true; + if(!Queue.Contains(ChunkToBuild)) + Queue.Add(ChunkToBuild); + + //_closestChunkComparer.PlayerPos = _world.PlayerPosition; + //Queue.Sort (_closestChunkComparer); } public void Start(){ - try{ - while(true){ - if( Stop) - break; - - //ThreadManager.Sleep(SleepTime * ThreadCount); - - lock(Queue){ - if(Discard){ - Queue.Clear(); - Discard = false; - continue; - } - if(Queue.Count != 0 ){ + while(true){ + if( Stop) + break; - if(_player != null){ - _closestChunkComparer.PlayerPos = _world.PlayerPosition; - lock(Queue) - Queue.Sort(_closestChunkComparer); - } - - if(Queue[0] != null){ - Queue[0].Build(); - if(Queue.Count != 0) - Queue.RemoveAt(0); - }else - Queue.RemoveAt(0); - } - } + //ThreadManager.Sleep (1); + + if (Queue.Count != 0) { + Queue [0].Build(); + Queue.RemoveAt (0); } - }catch(Exception e){ - Debug.Log(e.ToString()); } } } diff --git a/Assets/GraphicsOptions.cs b/Assets/GraphicsOptions.cs index f44bc57..3918f77 100644 --- a/Assets/GraphicsOptions.cs +++ b/Assets/GraphicsOptions.cs @@ -19,7 +19,7 @@ public static class GraphicsOptions static GraphicsOptions() { - ChunkLoaderRadius = 10; + ChunkLoaderRadius = 15; Lod = true; } } diff --git a/Assets/Movement.cs b/Assets/Movement.cs index a2f90ea..f556c5d 100644 --- a/Assets/Movement.cs +++ b/Assets/Movement.cs @@ -20,11 +20,14 @@ public class Movement : MonoBehaviour { public AudioClip SwooshClip; private GameObject Debris; private bool _lock; + private float _leftTargetVolume = 1, _rightTargetVolume = 1; + private float _originalVolume; void Start(){ Debris = GameObject.FindGameObjectWithTag ("Debris"); LeftSource = GameObject.FindGameObjectWithTag ("LeftSource").GetComponent(); RightSource = GameObject.FindGameObjectWithTag ("RightSource").GetComponent(); + _originalVolume = (RightSource.volume + LeftSource.volume) * .5f; } public void Lock(){ @@ -37,6 +40,16 @@ public void Unlock(){ // Update is called once per frame void Update () { + + LeftSource.volume = Mathf.Lerp (LeftSource.volume, _originalVolume * _leftTargetVolume, Time.deltaTime * 2f); + RightSource.volume = Mathf.Lerp (RightSource.volume, _originalVolume * _rightTargetVolume, Time.deltaTime * 2f); + + if (LeftSource.volume < 0.05f) + LeftSource.Stop (); + + if (RightSource.volume < 0.05f) + RightSource.Stop (); + if (_lock) return; @@ -49,22 +62,24 @@ void Update () { StartTrail (ref LeftTrail, LeftPosition); LeftSource.transform.position = LeftPosition; LeftSource.clip = SwooshClip; + _leftTargetVolume = 1; if(!LeftSource.isPlaying) LeftSource.Play (); } else { StopTrail (ref LeftTrail); - LeftSource.Stop (); + _leftTargetVolume = 0; } if (zAngle > 45 && zAngle < 135 || zAngle > 225 && zAngle < 315 || xAngle > 45 && xAngle < 90 || xAngle > 270 && xAngle < 315) { StartTrail (ref RightTrail, RightPosition); RightSource.transform.position = RightPosition; RightSource.clip = SwooshClip; + _rightTargetVolume = 1; if(!RightSource.isPlaying) RightSource.Play (); } else { StopTrail (ref RightTrail); - RightSource.Stop (); + _rightTargetVolume = 0; } float scale = (Time.timeScale != 1) ? (1 / Time.timeScale) * .5f : 1; diff --git a/Assets/NeonSkylines.png b/Assets/NeonSkylines.png new file mode 100644 index 0000000..e58dc38 Binary files /dev/null and b/Assets/NeonSkylines.png differ diff --git a/Assets/NeonSkylines.png.meta b/Assets/NeonSkylines.png.meta new file mode 100644 index 0000000..ca3ec74 --- /dev/null +++ b/Assets/NeonSkylines.png.meta @@ -0,0 +1,76 @@ +fileFormatVersion: 2 +guid: c32b5e23bb054254f9d1a8637f36aac3 +timeCreated: 1510452651 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapU: -1 + wrapV: -1 + wrapW: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Terrain.mat b/Assets/Terrain.mat index f5d57cb..81e2128 100644 --- a/Assets/Terrain.mat +++ b/Assets/Terrain.mat @@ -8,8 +8,8 @@ Material: m_PrefabInternal: {fileID: 0} m_Name: Terrain m_Shader: {fileID: 4800000, guid: f41b97872ce3bba439516a22765e895b, type: 3} - m_ShaderKeywords: _AA_ON _ALPHATEST_ON _EMISSION _FADE_ON _GLOW_ON _MODE_BARY _QUAD_ON - _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _WLIGHT_SURFACE _WSTYLE_DEFAULT _WUV_UV0 + m_ShaderKeywords: _AA_ON _ALPHATEST_ON _EMISSION _GLOW_ON _MODE_BARY _QUAD_ON _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + _WLIGHT_SURFACE _WSTYLE_DEFAULT _WUV_UV0 m_LightmapFlags: 4 m_EnableInstancingVariants: 0 m_DoubleSidedGI: 0 @@ -74,7 +74,7 @@ Material: - _FDist: 0.009000001 - _FMode: 0 - _FPow: 6 - - _Fade: 1 + - _Fade: 0 - _Fold: 31 - _GDist: 0.16 - _GEmission: 1.05 @@ -108,7 +108,7 @@ Material: - _WUV: 0 - _ZWrite: 1 m_Colors: - - _Color: {r: 0.9999999, g: 0.10834081, b: 0.6438709, a: 1} - - _EmissionColor: {r: 0.9999999, g: 0.10834081, b: 0.6438709, a: 1} - - _GColor: {r: 0.9999999, g: 0.10834081, b: 0.6438709, a: 1} - - _WColor: {r: 0.9999999, g: 0.10834081, b: 0.6438709, a: 1} + - _Color: {r: 1, g: 0.39215684, b: 7e-45, a: 1} + - _EmissionColor: {r: 1, g: 0.39215684, b: 7e-45, a: 1} + - _GColor: {r: 1, g: 0.39215684, b: 7e-45, a: 1} + - _WColor: {r: 1, g: 0.39215684, b: 7e-45, a: 1} diff --git a/Assets/TimeControl.cs b/Assets/TimeControl.cs index 22b0280..a2eda4e 100644 --- a/Assets/TimeControl.cs +++ b/Assets/TimeControl.cs @@ -22,7 +22,8 @@ public class TimeControl : MonoBehaviour { public Text Score, ScoreCenter; private float _score; public bool Lost = true;//To simulate the start menu - public Text GameOver, Title; + public Text GameOver; + public RawImage Title; public Text RestartBtn, StartBtn; private float _targetGameOver, _targetRestart, _targetScore, _targetStart, _targetTitle, _targetPitch = 1; public GameObject PlayerPrefab; @@ -115,9 +116,10 @@ void Update(){ StartBtn.color = new Color(StartBtn.color.r, StartBtn.color.g, StartBtn.color.b, Mathf.Lerp (StartBtn.color.a, _targetStart, Time.deltaTime * 4f * (1/Time.timeScale))); GameOver.color = new Color(GameOver.color.r, GameOver.color.g, GameOver.color.b, Mathf.Lerp (GameOver.color.a, _targetGameOver, Time.deltaTime * 4f * (1/Time.timeScale))); RestartBtn.color = new Color(RestartBtn.color.r, RestartBtn.color.g, RestartBtn.color.b, Mathf.Lerp (RestartBtn.color.a, _targetRestart, Time.deltaTime * 4f * (1/Time.timeScale))); - Score.color = new Color(Score.color.r, Score.color.g, Score.color.b, Mathf.Lerp (Score.color.a, 1-_targetScore, Time.deltaTime * 2f * (1/Time.timeScale))); - ScoreCenter.color = new Color(ScoreCenter.color.r, ScoreCenter.color.g, ScoreCenter.color.b, Mathf.Lerp (ScoreCenter.color.a, _targetScore, Time.deltaTime * 2f * (1/Time.timeScale))); - + if (_targetTitle != 1) { + Score.color = new Color (Score.color.r, Score.color.g, Score.color.b, Mathf.Lerp (Score.color.a, 1 - _targetScore, Time.deltaTime * 2f * (1 / Time.timeScale))); + ScoreCenter.color = new Color (ScoreCenter.color.r, ScoreCenter.color.g, ScoreCenter.color.b, Mathf.Lerp (ScoreCenter.color.a, _targetScore, Time.deltaTime * 2f * (1 / Time.timeScale))); + } if (Lost) return; diff --git a/Assets/World.cs b/Assets/World.cs index 37786c1..51333e8 100644 --- a/Assets/World.cs +++ b/Assets/World.cs @@ -23,13 +23,23 @@ void Awake(){ Application.targetFrameRate = -1; _meshQueue = new MeshQueue (this); _generationQueue = new GenerationQueue (this); - StartCoroutine(_generationQueue.Start()); + } void Update(){ PlayerPosition = Player.transform.position; - GenQueue = _generationQueue.Queue.Count; - MeshQueue = _meshQueue.Queue.Count; + + int _genCount = 0, _meshCount = 0; + foreach (KeyValuePair Pair in Chunks) { + if (!Pair.Value.IsGenerated) + _genCount++; + + if (Pair.Value.ShouldBuild) + _meshCount++; + } + + GenQueue = _genCount; + MeshQueue = _meshCount; } void OnApplicationQuit(){ @@ -121,9 +131,4 @@ public Chunk GetChunkByOffset(Vector3 Offset) { } return null; } - - public bool Discard{ - get{ return (_meshQueue != null) ? _meshQueue.Discard : true; } - } - }