public void SetActiveAgent(Agent agent, EventBusData sender = null)
    {
        var previous = ActiveAgent;

        ActiveAgent = agent;
        EventBus.FireEvent(new ActiveAgentChangedEventBusData(previous)
        {
            Sender = sender
        });
    }
Esempio n. 2
0
    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);
        }
    }
Esempio n. 3
0
    public bool ExistsUpstream(EventBusData data)
    {
        var test = this;

        while (test != null)
        {
            if (test == data)
            {
                return(true);
            }

            test = test.Sender;
        }

        return(false);
    }
Esempio n. 4
0
    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);
    }