diff --git a/Assets/Scripts/Arena Stats.asset b/Assets/Scripts/Arena Stats.asset index 8a67059..fbce64e 100644 --- a/Assets/Scripts/Arena Stats.asset +++ b/Assets/Scripts/Arena Stats.asset @@ -12,4 +12,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 8de175900b604adb984b49af64538a07, type: 3} m_Name: Arena Stats m_EditorClassIdentifier: - secondsBetweenSpawners: 10 + secondsBetweenSpawners: 15 + initWaitToSpawn: 3 + waveSize: 3 diff --git a/Assets/Scripts/Arena.cs b/Assets/Scripts/Arena.cs index 3ac4267..1920e9e 100644 --- a/Assets/Scripts/Arena.cs +++ b/Assets/Scripts/Arena.cs @@ -34,12 +34,17 @@ public class Arena : MonoBehaviour { yield return new WaitForSeconds(stats.initWaitToSpawn); int currentSpawner = 0; - - while (true) { - SpawnEnemy(currentSpawner); - currentSpawner = Random.Range(0, spawners.Length); - yield return new WaitForSeconds(stats.secondsBetweenSpawners); + int amountSpawned = 0; + while(true){ + while (amountSpawned < stats.waveSize) { + currentSpawner = Random.Range(0, spawners.Length); + SpawnEnemy(currentSpawner); + amountSpawned++; + } + yield return new WaitForSeconds(stats.secondsBetweenSpawners); + amountSpawned = 0; } + } #if UNITY_EDITOR diff --git a/Assets/Scripts/ArenaStats.cs b/Assets/Scripts/ArenaStats.cs index d4a6f91..32ca27a 100644 --- a/Assets/Scripts/ArenaStats.cs +++ b/Assets/Scripts/ArenaStats.cs @@ -4,4 +4,6 @@ public class ArenaStats : ScriptableObject { [Min(0f)] public float secondsBetweenSpawners = 3f; [Min(0f)] public float initWaitToSpawn = 3f; + [Min(0f)] public float waveSize = 3f; + } \ No newline at end of file