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-03-12 16:58:18 +01:00
|
|
|
private void OnCollisionEnter(Collision collision)
|
2021-02-15 10:44:04 +01:00
|
|
|
{
|
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 16:58:18 +01:00
|
|
|
if (collision.gameObject.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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|