public bool TriggerEvent(IGenericEvent evt) { InitiateListener(evt.GetType()); //Debug.Log("Event Dictionary Type Count" + eventDictionary[evt.GetType()].Count); for (int i = eventDictionary[evt.GetType()].Count - 1; i >= 0; i--) { //Debug.Log("Event Dictionary Type Count" + eventDictionary[evt.GetType()].Count); if (i >= eventDictionary[evt.GetType()].Count) { //Debug.Log("Calling Continue"); continue; } WeakReference <IGenericEventListener> listen = eventDictionary[evt.GetType()][i]; IGenericEventListener check; listen.TryGetTarget(out check); if (check == null) { //Debug.Log("Check was null"); Type type = evt.GetType(); UnregisterListener(check); continue; } if (check.HandleEvent(evt)) { //Debug.Log("Calling HandleEvent"); return(true); } } return(false); }
private bool ValidateType(IGenericEvent @event) { return(@event.GetType() == typeof(Event)); }