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

19 lines
538 B
C#

using System;
using System.Collections;
using System.Collections.Generic;
using Ktyl.Util;
using UnityEngine;
using UnityEngine.InputSystem;
public class DeathZone : MonoBehaviour
{
[SerializeField] private PlayerDeath pd;
private void OnTriggerEnter(Collider other)
{
// Checks to make sure other collider is the Player. Sets player variable as Player game object and starts the coroutine.
if (other.gameObject.CompareTag("Player"))
{
StartCoroutine(pd.RespawnPlayer());
}
}
}