38 lines
712 B
C#
38 lines
712 B
C#
|
using SciFiShipController;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class TriggerZone : MonoBehaviour
|
||
|
{
|
||
|
protected ShipControlModule _ship;
|
||
|
|
||
|
protected void OnTriggerEnter(Collider other)
|
||
|
{
|
||
|
if (other.gameObject.TryGetComponent(out ShipControlModule ship))
|
||
|
{
|
||
|
_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");
|
||
|
}
|
||
|
}
|