You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
980 B
40 lines
980 B
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
using UnityEngine.Events; |
|
using UnityEngine.Serialization; |
|
|
|
public class EventOnOff : MonoBehaviour |
|
{ |
|
[System.Serializable] |
|
public class EnableEvent : UnityEvent { } |
|
[FormerlySerializedAs("onEnable")] |
|
[SerializeField] |
|
[Space(10)] |
|
private EnableEvent m_OnEnabled = new EnableEvent(); |
|
public EnableEvent OnEnabled |
|
{ |
|
get { return m_OnEnabled; } |
|
set { m_OnEnabled = value; } |
|
} |
|
private void OnEnable() |
|
{ |
|
OnEnabled.Invoke(); |
|
} |
|
|
|
[System.Serializable] |
|
public class DisableEvent : UnityEvent { } |
|
[FormerlySerializedAs("onDisable")] |
|
[SerializeField] |
|
[Space(10)] |
|
private DisableEvent m_OnDisabled = new DisableEvent(); |
|
public DisableEvent OnDisabled |
|
{ |
|
get { return m_OnDisabled; } |
|
set { m_OnDisabled = value; } |
|
} |
|
private void OnDisable() |
|
{ |
|
OnDisabled.Invoke(); |
|
} |
|
}
|
|
|