2021-03-03 13:53:52 +01:00
|
|
|
using System;
|
2021-02-15 10:44:04 +01:00
|
|
|
using UnityEngine;
|
2021-03-12 16:58:18 +01:00
|
|
|
|
2021-02-15 10:44:04 +01:00
|
|
|
public class DeathZone : MonoBehaviour
|
2021-03-12 12:52:56 +01:00
|
|
|
{
|
2021-02-15 10:44:04 +01:00
|
|
|
private void OnTriggerEnter(Collider other)
|
|
|
|
{
|
2021-02-15 17:23:29 +01:00
|
|
|
// Checks to make sure other collider is the Player. Sets player variable as Player game object and starts the coroutine.
|
2021-03-12 18:41:34 +01:00
|
|
|
if (other.TryGetComponent(out PlayerDeath playerDeath))
|
2021-02-15 10:44:04 +01:00
|
|
|
{
|
2021-03-12 16:58:18 +01:00
|
|
|
playerDeath.Respawn();
|
2021-02-15 10:44:04 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|