public void StopListening(AllEventTypes eventType, UnityAction listener) { UnityEvent thisEvent = null; if (eventDictionary.TryGetValue(eventType, out thisEvent)) { thisEvent.RemoveListener(listener); } }
public void TriggerEvent(AllEventTypes eventType) { UnityEvent thisEvent = null; if (eventDictionary.TryGetValue(eventType, out thisEvent)) { thisEvent.Invoke(); } }
public void StartListening(AllEventTypes eventType, UnityAction listener) { UnityEvent thisEvent = null; if (eventDictionary.TryGetValue(eventType, out thisEvent)) { thisEvent.AddListener(listener); } else { thisEvent = new UnityEvent(); thisEvent.AddListener(listener); eventDictionary.Add(eventType, thisEvent); } }
public bool AppliesTo(IEnumerable <Type> eventTypes) { return(eventTypes .Intersect(AllEventTypes).Any() || eventTypes.Any(type => AllEventTypes.Any(type.CanBeCastTo))); }