From 5ada6671a65b254f9c5d1a5b33ba439e4e9d9265 Mon Sep 17 00:00:00 2001 From: Sveske Juice Date: Sun, 21 Apr 2024 14:28:25 +0200 Subject: [PATCH] spawn mechanics --- Assets/Scripts/Manager/EnemySpawnManager.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/Manager/EnemySpawnManager.cs b/Assets/Scripts/Manager/EnemySpawnManager.cs index 648de7d..3d7775a 100644 --- a/Assets/Scripts/Manager/EnemySpawnManager.cs +++ b/Assets/Scripts/Manager/EnemySpawnManager.cs @@ -44,6 +44,8 @@ public class EnemySpawnManager : MonoBehaviour public void OnPlayButtonClicked() { + if (GameManager.Instance.CurrentNumEnemies != 0) return; + HasStarted = true; PopWave(); } @@ -58,7 +60,7 @@ public class EnemySpawnManager : MonoBehaviour if (HasStarted && IsAutoPlaying) time += Time.deltaTime; - if (waveQueue.Count > 0 && waveQueue.Peek().spawnTime < time) + if (waveQueue.Count > 0 && (GameManager.Instance.CurrentNumEnemies == 0 && IsAutoPlaying)) { PopWave(); }