protected virtual IEnumerator StartGameCycle() { waves = gameManager.waveGenerator.GenerateAllWaves(); foreach (var wave in waves) { gameManager.viewSoloGame.RefreshWaveStatus(); currentCash += wave.initCash; GainWaveCashEvent?.Invoke(wave, wave.initCash); currentShield = 0; RefreshShieldEvent?.Invoke(); maxWaveShield = currentShield; enemyWaveCount = 0; gameManager.viewSoloGame.RefreshWaveStatus(); yield return(new WaitForSeconds(wave.waveInterval)); //begin spawning enemies enemyWaveCount = wave.enemies.Count; enemyAliveCount = enemyWaveCount; currentWave++; gameManager.viewSoloGame.RefreshWaveStatus(); yield return(StartCoroutine(gameManager.enemySpawner.SpawnEnemy(wave))); while (enemyAliveCount > 0) { yield return(0); } gameManager.viewSoloGame.RefreshWaveStatus(); } VictoryEvent?.Invoke(); }
private void Victory() { Time.timeScale = 0; if (VictoryEvent != null) { VictoryEvent.Invoke(); } enabled = false; }