void OnEnable() { globalSoundManager.Play(prepare); text = GetComponent <Text>(); remainSeconds = 5; StartCoroutine(StartAnimation()); }
void Start() { globalSoundManager = GlobalSoundManager.Get(); globalSoundManager.Play(prepare); text = GetComponent <Text>(); remainSeconds = 10; StartCoroutine(StartAnimation()); }
IEnumerator StartAnimation() { for (int i = remainSeconds; i > 0; i--) { if (i <= 5) { globalSoundManager.Play(beep); } UpdateText(i); yield return(new WaitForSeconds(1f)); } text.text = "FIGHT!"; globalSoundManager.Play(gameBegins); yield return(new WaitForSeconds(3f)); Destroy(gameObject); }
IEnumerator CoShowPlayerDeadNotice(string playerName) { globalSoundManager.Play(deadNoticeSound); GameObject playerDeadNotice = GameObject.Find("UI/InGameUI/PlayerUI/PlayerDeadNotice"); playerDeadNotice.GetComponent <Text>().text = playerName + " was eaten alive by Zombies."; playerDeadNotice.SetActive(true); yield return(new WaitForSeconds(5f)); playerDeadNotice.SetActive(false); }