diff --git a/Assets/Scripts/Manager/EnemySpawnManager.cs b/Assets/Scripts/Manager/EnemySpawnManager.cs index 79b8cea..895a5f2 100644 --- a/Assets/Scripts/Manager/EnemySpawnManager.cs +++ b/Assets/Scripts/Manager/EnemySpawnManager.cs @@ -55,15 +55,10 @@ public class EnemySpawnManager : MonoBehaviour void Update() { - if (waveQueue.Count <= 0) - { - return; - } - if (HasStarted && IsAutoPlaying) time += Time.deltaTime; - if (waveQueue.Peek().spawnTime < time) + if (waveQueue.Count > 0 && waveQueue.Peek().spawnTime < time) { PopWave(); } @@ -81,6 +76,10 @@ public class EnemySpawnManager : MonoBehaviour void PopWave() { + if (waveQueue.Count <= 0) + return; + + time = 0; WaveNum++;