// UltEvents // Copyright 2020 Kybernetik //
using UnityEngine;
namespace UltEvents
{
///
/// Holds s which are called by various update events:
/// , , and .
///
[AddComponentMenu(UltEventUtils.ComponentMenuPrefix + "Update Events")]
[HelpURL(UltEventUtils.APIDocumentationURL + "/UpdateEvents")]
[DisallowMultipleComponent]
public class UpdateEvents : MonoBehaviour
{
/************************************************************************************************************************/
[SerializeField]
private UltEvent _UpdateEvent;
/// Invoked by .
public UltEvent UpdateEvent
{
get
{
if (_UpdateEvent == null)
_UpdateEvent = new UltEvent();
return _UpdateEvent;
}
set { _UpdateEvent = value; }
}
/// Invokes .
public virtual void Update()
{
if (_UpdateEvent != null)
_UpdateEvent.Invoke();
}
/************************************************************************************************************************/
[SerializeField]
private UltEvent _LateUpdateEvent;
/// Invoked by .
public UltEvent LateUpdateEvent
{
get
{
if (_LateUpdateEvent == null)
_LateUpdateEvent = new UltEvent();
return _LateUpdateEvent;
}
set { _LateUpdateEvent = value; }
}
/// Invokes .
public virtual void LateUpdate()
{
if (_LateUpdateEvent != null)
_LateUpdateEvent.Invoke();
}
/************************************************************************************************************************/
[SerializeField]
private UltEvent _FixedUpdateEvent;
/// Invoked by .
public UltEvent FixedUpdateEvent
{
get
{
if (_FixedUpdateEvent == null)
_FixedUpdateEvent = new UltEvent();
return _FixedUpdateEvent;
}
set { _FixedUpdateEvent = value; }
}
/// Invokes .
public virtual void FixedUpdate()
{
if (_FixedUpdateEvent != null)
_FixedUpdateEvent.Invoke();
}
/************************************************************************************************************************/
}
}