public static void TriggerEvent(Names.Events eventName) { UnityEvent thisEvent = null; if (instance.eventDictionary.TryGetValue(eventName.ToString(), out thisEvent)) { thisEvent.Invoke(); } }
public static void StopListening(Names.Events eventName, UnityAction listener) { if (eventManager == null) { return; } UnityEvent thisEvent = null; if (instance.eventDictionary.TryGetValue(eventName.ToString(), out thisEvent)) { thisEvent.RemoveListener(listener); } }
public static void StartListening(Names.Events eventName, UnityAction listener) { UnityEvent thisEvent = null; if (instance.eventDictionary.TryGetValue(eventName.ToString(), out thisEvent)) { thisEvent.AddListener(listener); } else { thisEvent = new UnityEvent(); thisEvent.AddListener(listener); instance.eventDictionary.Add(eventName.ToString(), thisEvent); } }