public void StartSpawning() { _currentWave++; if (_currentWave >= _numberOfWaves) { _currentWave = _numberOfWaves - 1; return; } else if (_currentWave + 1 == _numberOfWaves) { _isFinalWave = true; } _stopSpawningEnemies = false; _stopSpawningPowerUps = false; StartCoroutine(SpawnWaveRoutine(_currentWave)); StartCoroutine("SpawnPowerUpRoutine"); OnUpdateWaves?.Invoke(_currentWave + 1, _numberOfWaves); OnNextWave?.Invoke(); }
private void Start() { _numberOfWaves = _waves.Length; OnUpdateWaves?.Invoke(_currentWave, _numberOfWaves); }