// UltEvents // Copyright 2020 Kybernetik //
using UnityEngine;
namespace UltEvents
{
///
/// An event that takes a single parameter.
///
[System.Serializable]
public sealed class TriggerEvent3D : UltEvent { }
/************************************************************************************************************************/
///
/// Holds s which are called by various trigger events:
/// , , and .
///
[AddComponentMenu(UltEventUtils.ComponentMenuPrefix + "Trigger Events 3D")]
[HelpURL(UltEventUtils.APIDocumentationURL + "/TriggerEvents3D")]
[DisallowMultipleComponent]
[RequireComponent(typeof(Collider))]
public class TriggerEvents3D : MonoBehaviour
{
/************************************************************************************************************************/
[SerializeField]
private TriggerEvent3D _TriggerEnterEvent;
/// Invoked by .
public TriggerEvent3D TriggerEnterEvent
{
get
{
if (_TriggerEnterEvent == null)
_TriggerEnterEvent = new TriggerEvent3D();
return _TriggerEnterEvent;
}
set { _TriggerEnterEvent = value; }
}
/// Invokes .
public virtual void OnTriggerEnter(Collider collider)
{
if (_TriggerEnterEvent != null)
_TriggerEnterEvent.Invoke(collider);
}
/************************************************************************************************************************/
[SerializeField]
private TriggerEvent3D _TriggerStayEvent;
/// Invoked by .
public TriggerEvent3D TriggerStayEvent
{
get
{
if (_TriggerStayEvent == null)
_TriggerStayEvent = new TriggerEvent3D();
return _TriggerStayEvent;
}
set { _TriggerStayEvent = value; }
}
/// Invokes .
public virtual void OnTriggerStay(Collider collider)
{
if (_TriggerStayEvent != null)
_TriggerStayEvent.Invoke(collider);
}
/************************************************************************************************************************/
[SerializeField]
private TriggerEvent3D _TriggerExitEvent;
/// Invoked by .
public TriggerEvent3D TriggerExitEvent
{
get
{
if (_TriggerExitEvent == null)
_TriggerExitEvent = new TriggerEvent3D();
return _TriggerExitEvent;
}
set { _TriggerExitEvent = value; }
}
/// Invokes .
public virtual void OnTriggerExit(Collider collider)
{
if (_TriggerExitEvent != null)
_TriggerExitEvent.Invoke(collider);
}
/************************************************************************************************************************/
}
}