This commit is contained in:
kimrdd 2024-04-21 14:08:29 +02:00
commit 7c5fd59058
1 changed files with 5 additions and 6 deletions

View File

@ -55,15 +55,10 @@ public class EnemySpawnManager : MonoBehaviour
void Update() void Update()
{ {
if (waveQueue.Count <= 0)
{
return;
}
if (HasStarted && IsAutoPlaying) if (HasStarted && IsAutoPlaying)
time += Time.deltaTime; time += Time.deltaTime;
if (waveQueue.Peek().spawnTime < time) if (waveQueue.Count > 0 && waveQueue.Peek().spawnTime < time)
{ {
PopWave(); PopWave();
} }
@ -81,6 +76,10 @@ public class EnemySpawnManager : MonoBehaviour
void PopWave() void PopWave()
{ {
if (waveQueue.Count <= 0)
return;
time = 0; time = 0;
WaveNum++; WaveNum++;