From ef113a6a43f91823ce0573f83df2fbcc520a130b Mon Sep 17 00:00:00 2001 From: Soulaha Balde Date: Sun, 3 Apr 2022 15:58:24 -0400 Subject: [PATCH] Wave size increases by x every y wave --- Assets/Scenes/SoulahaScene.unity | 4 ---- Assets/Scenes/SoulahaScene.unity.meta | 2 +- Assets/Scripts/Arena.cs | 13 +++++++++---- Assets/Scripts/ArenaStats.cs | 5 ++++- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Assets/Scenes/SoulahaScene.unity b/Assets/Scenes/SoulahaScene.unity index eb6d8d1..80cb6cb 100644 --- a/Assets/Scenes/SoulahaScene.unity +++ b/Assets/Scenes/SoulahaScene.unity @@ -208,10 +208,6 @@ PrefabInstance: propertyPath: m_Name value: SceneStuff objectReference: {fileID: 0} - - target: {fileID: 8365024802335227869, guid: f7f5d2b1228d13f4d9015073aced3e81, type: 3} - propertyPath: orthographic size - value: 10.5 - objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: f7f5d2b1228d13f4d9015073aced3e81, type: 3} --- !u!4 &720678398 stripped diff --git a/Assets/Scenes/SoulahaScene.unity.meta b/Assets/Scenes/SoulahaScene.unity.meta index 6a70b89..1130262 100644 --- a/Assets/Scenes/SoulahaScene.unity.meta +++ b/Assets/Scenes/SoulahaScene.unity.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9145057a34a60964eb8cc79037227889 +guid: 8b8f40b774485ae4588cba2c53f8ac9d DefaultImporter: externalObjects: {} userData: diff --git a/Assets/Scripts/Arena.cs b/Assets/Scripts/Arena.cs index f75403f..e43b644 100644 --- a/Assets/Scripts/Arena.cs +++ b/Assets/Scripts/Arena.cs @@ -33,6 +33,7 @@ public class Arena : MonoBehaviour { public Transform graveyard { get; private set; } = null!; SafeZone safeZone = null!; + [field: SerializeField]int currWaveSize = 0; void Awake() => safeZone = GetComponentInChildren(); @@ -51,17 +52,21 @@ public class Arena : MonoBehaviour { IEnumerator SpawnEnemies() { yield return new WaitForSeconds(stats.initWaitToSpawn); - + currWaveSize = stats.initWaveSize; int currentSpawner = 0; int amountSpawned = 0; + int wave = 1; while(true){ - while (amountSpawned < stats.waveSize) { + while (amountSpawned < currWaveSize) { currentSpawner = Random.Range(0, spawners.Length); SpawnEnemy(currentSpawner); - amountSpawned++; + amountSpawned++; + } + if(wave++ >= stats.increaseWaveStep){ + if((currWaveSize += stats.waveIncrease) > stats.maxWaveSize) currWaveSize=stats.maxWaveSize; } - yield return new WaitForSeconds(stats.secondsBetweenSpawners); amountSpawned = 0; + yield return new WaitForSeconds(stats.secondsBetweenSpawners); } } diff --git a/Assets/Scripts/ArenaStats.cs b/Assets/Scripts/ArenaStats.cs index 32ca27a..b92300d 100644 --- a/Assets/Scripts/ArenaStats.cs +++ b/Assets/Scripts/ArenaStats.cs @@ -4,6 +4,9 @@ public class ArenaStats : ScriptableObject { [Min(0f)] public float secondsBetweenSpawners = 3f; [Min(0f)] public float initWaitToSpawn = 3f; - [Min(0f)] public float waveSize = 3f; + [Min(0f)] public int initWaveSize = 3; + [Min(0f)] public int maxWaveSize = 10; + [Min(0f), Tooltip("The amount of gladiator to add to wave")] public int waveIncrease = 1; + [Min(0f), Tooltip("How many waves before we increase by WaveIncrease")] public int increaseWaveStep = 3; } \ No newline at end of file