mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
29 lines
844 B
C#
29 lines
844 B
C#
using UnityEngine;
|
|
|
|
namespace NewHorizons.Components.Volumes
|
|
{
|
|
[RequireComponent(typeof(OWTriggerVolume))]
|
|
public abstract class BaseVolume : MonoBehaviour
|
|
{
|
|
private OWTriggerVolume _triggerVolume;
|
|
|
|
public virtual void Awake()
|
|
{
|
|
_triggerVolume = this.GetRequiredComponent<OWTriggerVolume>();
|
|
_triggerVolume.OnEntry += OnTriggerVolumeEntry;
|
|
_triggerVolume.OnExit += OnTriggerVolumeExit;
|
|
}
|
|
|
|
public virtual void OnDestroy()
|
|
{
|
|
if (_triggerVolume == null) return;
|
|
_triggerVolume.OnEntry -= OnTriggerVolumeEntry;
|
|
_triggerVolume.OnExit -= OnTriggerVolumeExit;
|
|
}
|
|
|
|
public abstract void OnTriggerVolumeEntry(GameObject hitObj);
|
|
|
|
public abstract void OnTriggerVolumeExit(GameObject hitObj);
|
|
}
|
|
}
|