예제 #1
0
    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();
    }
예제 #2
0
    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();
        }
    }
예제 #3
0
        //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
        }
예제 #4
0
 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);
         }
     }
 }
예제 #5
0
 public void CompleteWave(SpawnerStateEnum nextState)
 {
     OnWaveComplete?.Invoke(nextState);
 }