public void WaveCompleted() { GuiMessageManager.Instance.DisplayMessage($"Wave {CurrentLevel+1}/{LevelManager.Instance.levels.Count} accomplished"); CurrentLevel++; GameManager.Player.ReduceHp(-GameManager.Player.RepairPerRound); // TODO: Play some sound/particle with this? OnWaveComplete?.Invoke(); }
private void CompleteWave() { OnWaveComplete?.Invoke(m_CurrentWaveNumber); m_WaveTimer = m_TimeBetweenWaves; if (m_MapData.m_BoxymonWaves.Count > 0) { m_CurrentWave = m_MapData.m_BoxymonWaves.Dequeue(); OnWaveStart?.Invoke(++m_CurrentWaveNumber); } else { OnAllWavesComplete?.Invoke(); } }
//spawn all enemies in the current wave and setup next wave when done private IEnumerator SpawnAllSubWaves(Wave currWave) { //Extract all sub waves of current wave List <SubWave> subWaves = currWave.GetSubWaves(); for (int i = 0; i < subWaves.Count; i++) { SubWave currSubWave = subWaves[i]; for (int j = 0; j < currSubWave.GetNumOfEnemies(); j++) { SpawnEnemy(currSubWave); yield return(new WaitForSeconds(currWave.GetSpawnRate())); } yield return(new WaitForSeconds(currWave.GetTimeBetweenSubWaves())); } //Wave Ended _state = SpawnState.Waiting; _currWaveIndex++; OnWaveComplete?.Invoke(); //trigger event at Game Manager }
void EnemyDied() { enemiesLeft--; if (enemiesLeft == 0) { if (!HaveSpawnedAllEnemies()) { if (spawnWhenEnemiesCleared) { spawnWhenEnemiesCleared = false; SpawnNextEnemy(); } } else { foreach (GameObject indestructableObject in indestructableObjects) { Destroy(indestructableObject); } OnWaveComplete.Invoke(); Destroy(gameObject); } } }
public void CompleteWave(SpawnerStateEnum nextState) { OnWaveComplete?.Invoke(nextState); }