private void playerDeath() { playerAudio.PlayDeath(); isWalking = false; isGrounded = true; UpdateAnimations(); rb.AddForce(Vector2.up, ForceMode2D.Impulse); transform.eulerAngles = new Vector3(0, 0, 90); this.enabled = false; }
// Update is called once per frame void Update() { if (health <= 0) { health = 0; healthText.text = "Health: " + health; if (!invoked) { GameManager.GameOver.Invoke(); StartCoroutine(playerAudio.PlayDeath()); invoked = true; } } }
IEnumerator DieAndRespawn() { _art.SetActive(false); this.GetComponent <PlayerMove>().enabled = false; this.GetComponent <Rigidbody>().velocity = new Vector3(0, 0, 0); _pAudio.PlayDeath(); _ps.Play(); yield return(new WaitForSeconds(_respawnTime)); _art.SetActive(true); this.GetComponent <PlayerMove>().enabled = true; this.transform.position = new Vector3(0, 0, -10); _health = _maxHealth; UIManager.instance.setPlayerHealthBar(1); }