private void CheckWatchers(GameEvent gameEvent, EventWatchTiming timing) { EventWatchTiming watcherTiming; foreach (var watcher in watchers) { watcherTiming = watcher.GetWatchTiming(); if ((watcherTiming == timing) || (watcherTiming == EventWatchTiming.Any)) watcher.InspectEvent(gameEvent); } }
/// <summary> /// Add an event to the manager. If called during an update loop, the event will be added to the list of /// queued events, and will be updated with a time delta of 0 at the end of the current loop. /// </summary> /// <param name="gameEvent"></param> public virtual void AddEvent(GameEvent gameEvent) { List<GameEvent> eventList = isUpdating ? queuedEvents : events; eventList.Add(gameEvent); CheckWatchers(gameEvent, EventWatchTiming.OnCreate); }
/// <summary> /// Remove an event from the Manager /// </summary> /// <param name="gameEvent"></param> public virtual void RemoveEvent(GameEvent gameEvent) { events.Remove(gameEvent); }