spawn gladiator in waves
This commit is contained in:
parent
1fc46498d4
commit
6879efdf24
@ -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
|
||||
|
||||
@ -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);
|
||||
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
|
||||
|
||||
@ -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;
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user