protected virtual void OnWaveStarted(Wave wave) { wave.HasEnded += OnWaveEnded; _ActiveWaves.Add(wave); _State = EState.WAVE; bool isLastWave = _WaitingWaves.Count <= 0; Debug.Log("<color=lime>[WaveSystem] Succesfully started next wave!</color>"); WaveEventArgs payload = new WaveEventArgs(wave, isLastWave); WaveStarted?.Invoke(this, payload); }
protected virtual void OnWaveEnded(Wave wave) { wave.HasEnded -= OnWaveEnded; _ActiveWaves.Remove(wave); _CompletedWaves.Add(wave); bool isLastWave = _WaitingWaves.Count <= 0; WaveEventArgs payload = new WaveEventArgs(wave, isLastWave); WaveEnded?.Invoke(this, payload); if (isLastWave) { _State = EState.INACTIVE; } else { StartIntermission(); } }