revival/game/Assets/Scripts/Death & Respawn/DeathZone.cs

13 lines
393 B
C#

using UnityEngine;
public class DeathZone : MonoBehaviour
{
private void OnCollisionEnter(Collision collision)
{
// Checks to make sure other collider is the Player. Sets player variable as Player game object and starts the coroutine.
if (collision.gameObject.TryGetComponent(out PlayerDeath playerDeath))
{
playerDeath.Respawn();
}
}
}