Wave size increases by x every y wave
This commit is contained in:
parent
b60ff1ca91
commit
ef113a6a43
@ -208,10 +208,6 @@ PrefabInstance:
|
|||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
value: SceneStuff
|
value: SceneStuff
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 8365024802335227869, guid: f7f5d2b1228d13f4d9015073aced3e81, type: 3}
|
|
||||||
propertyPath: orthographic size
|
|
||||||
value: 10.5
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: f7f5d2b1228d13f4d9015073aced3e81, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: f7f5d2b1228d13f4d9015073aced3e81, type: 3}
|
||||||
--- !u!4 &720678398 stripped
|
--- !u!4 &720678398 stripped
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 9145057a34a60964eb8cc79037227889
|
guid: 8b8f40b774485ae4588cba2c53f8ac9d
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
|
|||||||
@ -33,6 +33,7 @@ public class Arena : MonoBehaviour {
|
|||||||
public Transform graveyard { get; private set; } = null!;
|
public Transform graveyard { get; private set; } = null!;
|
||||||
|
|
||||||
SafeZone safeZone = null!;
|
SafeZone safeZone = null!;
|
||||||
|
[field: SerializeField]int currWaveSize = 0;
|
||||||
|
|
||||||
void Awake() => safeZone = GetComponentInChildren<SafeZone>();
|
void Awake() => safeZone = GetComponentInChildren<SafeZone>();
|
||||||
|
|
||||||
@ -51,17 +52,21 @@ public class Arena : MonoBehaviour {
|
|||||||
|
|
||||||
IEnumerator SpawnEnemies() {
|
IEnumerator SpawnEnemies() {
|
||||||
yield return new WaitForSeconds(stats.initWaitToSpawn);
|
yield return new WaitForSeconds(stats.initWaitToSpawn);
|
||||||
|
currWaveSize = stats.initWaveSize;
|
||||||
int currentSpawner = 0;
|
int currentSpawner = 0;
|
||||||
int amountSpawned = 0;
|
int amountSpawned = 0;
|
||||||
|
int wave = 1;
|
||||||
while(true){
|
while(true){
|
||||||
while (amountSpawned < stats.waveSize) {
|
while (amountSpawned < currWaveSize) {
|
||||||
currentSpawner = Random.Range(0, spawners.Length);
|
currentSpawner = Random.Range(0, spawners.Length);
|
||||||
SpawnEnemy(currentSpawner);
|
SpawnEnemy(currentSpawner);
|
||||||
amountSpawned++;
|
amountSpawned++;
|
||||||
}
|
}
|
||||||
yield return new WaitForSeconds(stats.secondsBetweenSpawners);
|
if(wave++ >= stats.increaseWaveStep){
|
||||||
|
if((currWaveSize += stats.waveIncrease) > stats.maxWaveSize) currWaveSize=stats.maxWaveSize;
|
||||||
|
}
|
||||||
amountSpawned = 0;
|
amountSpawned = 0;
|
||||||
|
yield return new WaitForSeconds(stats.secondsBetweenSpawners);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,9 @@
|
|||||||
public class ArenaStats : ScriptableObject {
|
public class ArenaStats : ScriptableObject {
|
||||||
[Min(0f)] public float secondsBetweenSpawners = 3f;
|
[Min(0f)] public float secondsBetweenSpawners = 3f;
|
||||||
[Min(0f)] public float initWaitToSpawn = 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;
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user