/* * @Param in_Event is the event occurred that's going to dispatch. */ public static void TriggerEvent(eGyroEvents in_Event) { UnityEvent thisEvent = null; if (instance.m_DictionaryEvents.TryGetValue(in_Event, out thisEvent)) { thisEvent.Invoke(); } }
/* * @Param in_Event is the event type wanted to stop a listening event. * @Param in_Listener is the action wanted remove of the event listener. */ public static void StopListening(eGyroEvents in_Event, UnityAction in_Listener) { if (m_CachedEventManager == null) { return; } UnityEvent thisEvent = null; if (instance.m_DictionaryEvents.TryGetValue(in_Event, out thisEvent)) { thisEvent.RemoveListener(in_Listener); } }
/* * @Param in_Event is the event type wanted to add a listener. * @Param in_Listener is the action wanted to execute when the event occurs. */ public static void StartListening(eGyroEvents in_Event, UnityAction in_Listener) { UnityEvent thisEvent = null; if (instance.m_DictionaryEvents.TryGetValue(in_Event, out thisEvent)) { thisEvent.AddListener(in_Listener); } else { thisEvent = new UnityEvent(); thisEvent.AddListener(in_Listener); instance.m_DictionaryEvents.Add(in_Event, thisEvent); } }