From e5da90700a4b6c4bacd98f4a6930ed25e14708a3 Mon Sep 17 00:00:00 2001 From: BOT Alex <44818698+MagicBOTAlex@users.noreply.github.com> Date: Sun, 21 Apr 2024 14:05:58 +0200 Subject: [PATCH] Num enemies now accurate --- Assets/Scripts/Manager/EnemySpawnManager.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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++;