Example #1
0
    // Called by the HUD script upon clicking of next wave button or Enter key press
    public void StartNextWave()
    {
        if (stateSystem.IsGameWave())
        {
            // Clear all dead bodies
            foreach (GameObject enemy in deadBodies)
            {
                if (enemy != null)
                {
                    enemy.GetComponent <EnemyController>().StartFadeout();
                }
            }

            deadBodies.Clear();

            // Reset cooldown for all abilities
            playerAction.ResetAllCooldowns();
            hud.ResetAllCooldownIndicators();

            // Update states
            stateSystem.SetWaveState(StateSystem.WaveState.WaitingWaveSpawn);
            waveSystem.SetNextWave();
            waveCount   = waveSystem.GetWaveCount();
            waveKilled  = 0;
            getNewSpawn = true;
        }
    }
Example #2
0
    public void StopWave()
    {
        waves.StopWave();
        waves.SetNextWave();

        if (waves.currentWave >= waves.maxEnemies.Count)
        {
            maxEnemies = waves.maxEnemies[waves.maxEnemies.Count - 1];
        }
        else
        {
            maxEnemies = waves.maxEnemies[waves.currentWave];
        }


        if (OnLevelEndWave != null)
        {
            OnLevelEndWave();
        }
    }