void Update() { if (isWin) { topBarController.level++; isWin = false; StopGame(); gameCamera.GetComponent <Animator>().SetTrigger("GoToNextLevel"); CurrentBuildNumber++; if (CurrentBuildNumber > 4) { CurrentBuildNumber = 0; } } if (isLose) { PlayerPrefs.SetInt("battery", PlayerPrefs.GetInt("battery", 5) - 1); isLose = false; StopGame(); gameCamera.GetComponent <Animator>().SetTrigger("lose"); StartCoroutine("EnableCameraSmoke"); ExplosionList[CurrentBuildNumber].Play(); SmokeListBuild[CurrentBuildNumber].Play(); BuildsNormal[CurrentBuildNumber].SetActive(false); BuildsDestroyed[CurrentBuildNumber].SetActive(true); UIGameLose.SetActive(true); Debug.Log("YOU LOSE"); } }
public void DisableLoseEffects() { UIGameLose.SetActive(false); Smoke.Stop(); Smoke.gameObject.SetActive(false); ExplosionList[CurrentBuildNumber].Stop(); SmokeListBuild[CurrentBuildNumber].Stop(); }
IEnumerator EnableCameraSmoke() { yield return(new WaitForSeconds(3.0f)); UIGameLose.SetActive(true); var text = GameLoseText.text.Replace("[lvl]", topBarController.level.ToString()); GameLoseText.text = text; Smoke.gameObject.SetActive(true); Smoke.Play(); yield return(null); }