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

13 lines
393 B
C#
Raw Normal View History

using UnityEngine;
public class DeathZone : MonoBehaviour
2021-03-12 12:52:56 +01:00
{
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();
}
}
}