public void SetActiveAgent(Agent agent, EventBusData sender = null) { var previous = ActiveAgent; ActiveAgent = agent; EventBus.FireEvent(new ActiveAgentChangedEventBusData(previous) { Sender = sender }); }
public static void FireEvent(EventBusData data) { var map = GetMap(data.GetType()); map.RemoveAll(m => m.Target == null && !m.Method.IsStatic); var copy = new IRegisteredListener[map.Count]; map.CopyTo(copy); foreach (var listener in copy) { listener.FireListener(data); } }
public bool ExistsUpstream(EventBusData data) { var test = this; while (test != null) { if (test == data) { return(true); } test = test.Sender; } return(false); }
private Tween BeginFader(bool fadeIn, EventBusData sender = null) { EventBus.FireEvent(new FaderBeginEventBusData(fadeIn) { Sender = sender }); _fader.blocksRaycasts = false; var tween = _fader.DOFade(fadeIn ? 1f : 0f, 1f); tween.onComplete += () => { EventBus.FireEvent(new FaderCompleteEventBusData(fadeIn) { Sender = sender }); _fader.blocksRaycasts = fadeIn; }; return(tween); }