Exemplo n.º 1
0
 // Start is called before the first frame update
 void Start()
 {
     m_nextSpawnTimer     = m_wavesData.FirstWaveDelay;
     m_unitsSpawnedInWave = 0;
     m_waveTimerUI        = GameManager.Instance.m_waveTimerUI;
     m_waveTimerUI.Activate();
 }
Exemplo n.º 2
0
 // Update is called once per frame
 void Update()
 {
     if (!GameManager.GAME_OVER)
     {
         m_currentCooldown += Time.deltaTime;
         if (m_currentCooldown > m_nextSpawnTimer && m_unitsSpawnedInWave < m_wavesData.Waves[m_currentWaveIndex].CreaturesData.Count)
         {
             m_waveTimerUI.Activate(false);
             Spawn(m_wavesData.Waves[m_currentWaveIndex].CreaturesData[m_unitsSpawnedInWave]);
             ResetUnitsCooldown();
             m_unitsCount++;
         }
         else if (m_unitsCount == 0 && AreUnitsAllSpawned())
         {
             EndWave();
         }
         m_waveTimerUI.UpdateTimer(m_currentCooldown, m_nextSpawnTimer);
     }
 }