//TODO: refactor CheckForEnemiesAlive to be less dumb IEnumerator CheckForWaveEnd() { Debug.Log("WaveManager: Check for wave end"); while (CheckForEnemiesAlive()) //Can impl this better { yield return(new WaitForSeconds(.5f)); } if (cur_wave_index < wave_list.Count) { Debug.Log("Wave manager: wave complete!"); cur_wave_index++; if (cur_wave_index >= wave_list.Count) { Debug.Log("Wave manager: all waves completed successfully!"); AllWavesCompletedEvent?.Invoke(this, System.EventArgs.Empty); GameOverHandler.DoGameWin(); } } WaveEndEvent?.Invoke(this, System.EventArgs.Empty); flag_wave_in_progress = false; }
IEnumerator CheckForWaveEnd() { Debug.Log("WaveManager: Check for wave end"); while (CheckForEnemiesAlive()) { yield return(new WaitForSeconds(.5f)); } if (cur_wave_index < wave_list.Count) { Debug.Log("Wave manager: wave complete!"); cur_wave_index++; } else { Debug.Log("Wave manager: all waves completed successfully!"); AllWavesCompletedEvent?.Invoke(this, System.EventArgs.Empty); } flag_wave_in_progress = false; }