2023-07-24 16:38:13 +03:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
public class TriggerZone : MonoBehaviour
|
|
|
|
{
|
2023-08-01 11:28:14 +03:00
|
|
|
protected ShipPathFollower _ship;
|
2023-07-24 16:38:13 +03:00
|
|
|
|
|
|
|
protected void OnTriggerEnter(Collider other)
|
|
|
|
{
|
2023-08-01 11:28:14 +03:00
|
|
|
if (other.gameObject.TryGetComponent(out ShipPathFollower ship))
|
2023-07-24 16:38:13 +03:00
|
|
|
{
|
|
|
|
_ship = ship;
|
|
|
|
InZone();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void OnTriggerExit(Collider other)
|
|
|
|
{
|
|
|
|
if (_ship != null)
|
|
|
|
{
|
|
|
|
OutZone();
|
|
|
|
_ship = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected virtual void InZone()
|
|
|
|
{
|
|
|
|
Debug.Log("InZone");
|
|
|
|
}
|
|
|
|
|
|
|
|
protected virtual void OutZone()
|
|
|
|
{
|
|
|
|
Debug.Log("OutZone");
|
|
|
|
}
|
|
|
|
}
|