public static void TriggerEvent(string eventName, string value = null) { CustomStringEvent thisEvent = null; if (instance.eventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.Invoke(value); } }
public static void StopListening(string eventName, UnityAction <string> listener) { if (eventManager == null) { return; } CustomStringEvent thisEvent = null; if (instance.eventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.RemoveListener(listener); } }
public static void StartListening(string eventName, UnityAction <string> listener) { //UnityEvent thisEvent = null; CustomStringEvent thisEvent = null; if (instance.eventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.AddListener(listener); } else { thisEvent = new CustomStringEvent(); thisEvent.AddListener(listener); instance.eventDictionary.Add(eventName, thisEvent); } }