void Update() { if (Input.GetButtonDown("Pause")) { if (!paused) { s.GetComponent <AudioSource>().Pause(); s2.GetComponent <AudioSource>().Pause(); } else if (paused) { s.GetComponent <AudioSource>().Play(); s2.GetComponent <AudioSource>().Play(); } paused = !paused; } if (paused) { PauseUI.SetActive(true); Time.timeScale = 0; } if (!paused) { PauseUI.SetActive(false); Time.timeScale = 1; } }
void Start() { animator = GetComponent <Animator>(); m = GameObject.FindGameObjectWithTag("Manager").GetComponent <Manager>(); rp = GameObject.FindGameObjectWithTag("RespawnPoint2"); s2 = GameObject.FindGameObjectWithTag("Shield2").GetComponent <Shield2>(); this.BroadcastMessage("TemporaryShield"); s2.GetComponent <AudioSource>().Play(); }
IEnumerator LifeDown() { animator.SetBool("Dead", true); this.speed = 0; bulletLevel = 4; s2.GetComponent <ParticleSystem>().enableEmission = false; yield return(new WaitForSeconds(1f)); s2.GetComponent <AudioSource>().Play(); s2.GetComponent <ParticleSystem>().enableEmission = true; animator.SetBool("Dead", false); bulletLevel = 0; bulletPower = 1; speed = 2; bulletSpeed = 3; this.speed = 2f; this.transform.position = rp.transform.position; }