public void PlayBtnPressed() { switch (currentState) { case GameStatus.next: waveNumber += 1; totalEnemies += waveNumber; break; default: totalEnemies = 3; TotalEscaped = 0; totalMoney = 10; TowerController.Shared.DestroyAllTowers(); TowerController.Shared.RenametagsBuildSite(); totalMoneyLbl.text = TotalMoney.ToString(); totalEscapeLbl.text = "Escaped: " + TotalEscaped.ToString(); audioSource.PlayOneShot(SoundController.Shared.NewGame); break; } DestroyAllEnemies(); totalKilled = 0; RoundEscaped = 0; currentWaveLbl.text = "Wave " + (waveNumber + 1); StartCoroutine(Spawn()); playBtn.gameObject.SetActive(false); }
public void isWaveOver() { totalEscapedLbl.text = "Escaped " + TotalEscaped.ToString() + "/10"; if ((roundEscaped + totalKilled) >= totalEnemies) { if (waveNo <= enemies.Length) { which2Spawn = waveNo; } print("wave Over"); SetCurrentGameState(); ShowMenu(); } }
public void playButtonPressed() { //Debug.Log("You pushed play"); switch (currentState) { case gameStatus.next: //waveNumber+=1; totalEnemies += waveNumber; //reset wave number if starting over and update gui if (waveNumber >= totalWaves) { waveNumber = 0; currentWaveLbl.text = "Wave " + (waveNumber + 1); } AudioSource.PlayOneShot(SoundManager.Instance.Death); destroyAllProjectiles(); break; default: totalEnemies = 3; TotalEscaped = 0; TotalMoney = 20; enemiesToSpawn = 0; //reset this TowerManager.Instance.DestroyAllTowers(); TowerManager.Instance.RenameTagsBuildSites(); totalMoneyLbl.text = TotalMoney.ToString(); totalEscapedLbl.text = "Escaped " + TotalEscaped.ToString() + "/10"; //destroy all game objects on screen audioSource.PlayOneShot(SoundManager.Instance.NewGame); break; } DestroyAllEnemies(); TotalKilled = 0; RoundEscaped = 0; currentWaveLbl.text = "Wave " + (waveNumber + 1); StartCoroutine(spawn()); playBtn.gameObject.SetActive(false); winBanner.gameObject.SetActive(false); loseBanner.gameObject.SetActive(false); }