void OnTriggerEnter(Collider other) { if (other.CompareTag("Ball")) { PlayerRespawn.Respawn(); } }
void Update() { RaycastHit hit; if (Physics.Linecast(transform.position + Vector3.up * CheckDistanceUp, transform.position - Vector3.up * CheckDistanceDown, out hit, groundLayer)) { if (grounded == false) { OnIce = hit.collider.tag == "Ice"; grounded = true; Landed.Invoke(); } } else { if (grounded == true) { grounded = false; Jumped.Invoke(); } if (view.IsMine && transform.position.y < -20) { respawn.Respawn(); } } }
public void Revive() { revivetimer.timeLeft = 5; PlayerHealth.health = 3; DeathMenu.SetActive(false); player.SetActive(true); ReviveLimit -= 1; playerRespawn.Respawn(); }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.tag == "Player") { PlayerRespawn playerRespawn = collision.gameObject.GetComponent <PlayerRespawn>(); playerRespawn.Respawn(); } }
private void OnCollisionEnter2D(Collision2D collision) { // This code gets called each frame player is inside trigger. if (collision.gameObject.tag == "Player") { PlayerRespawn playerRespawn = collision.gameObject.GetComponent <PlayerRespawn>(); playerRespawn.Respawn(); } }