2021-03-03 13:53:52 +01:00
|
|
|
using System;
|
2021-02-15 10:44:04 +01:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
using System.Linq;
|
2021-03-03 13:53:52 +01:00
|
|
|
using Ktyl.Util;
|
2021-02-15 10:44:04 +01:00
|
|
|
|
|
|
|
public class SafeZone : MonoBehaviour
|
|
|
|
{
|
2021-03-03 13:53:52 +01:00
|
|
|
[SerializeField] private SerialVector3 _respawnPosition;
|
2021-02-15 10:44:04 +01:00
|
|
|
|
2021-03-03 13:53:52 +01:00
|
|
|
private void OnTriggerStay(Collider other)
|
2021-02-15 10:44:04 +01:00
|
|
|
{
|
2021-02-15 17:23:29 +01:00
|
|
|
// Check if other game object is Player.
|
2021-02-15 14:14:42 +01:00
|
|
|
if (other.gameObject.name == "Player")
|
|
|
|
{
|
2021-03-03 13:53:52 +01:00
|
|
|
_respawnPosition.Value = other.gameObject.transform.position;
|
2021-02-15 10:44:04 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|