public static void triggerEvent(Events.EventList eventName) { UnityEvent thisEvent = null; if (Instance.eventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.Invoke(); Debugger.printLog("Trigger this event: " + eventName); } }
public static void stopListening(Events.EventList eventName, UnityAction listener) { if (instance == null) { return; } UnityEvent thisEvent = null; if (Instance.eventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.RemoveListener(listener); } Debugger.printLog("Stop listening to event: " + eventName); }
// OLD EventManager //Generic event EventManager public static void startListening(Events.EventList eventName, UnityAction listener) { UnityEvent thisEvent = null; if (Instance.eventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.AddListener(listener); } else { thisEvent = new UnityEvent(); thisEvent.AddListener(listener); instance.eventDictionary.Add(eventName, thisEvent); } Debugger.printLog("Start listening to event: " + eventName); }
public Subscriber(EventList pub) { this.pub = pub; SubscribePub(); }