Beispiel #1
0
    /* public static void TriggerEvent (string eventName, Object args )
     * {
     *   UnityEventWithParameter thisEvent = null;
     *   if (instance.eventDictonary.TryGetValue(eventName, out thisEvent))
     *   {
     *       thisEvent.Invoke();
     *   }
     * }*/

    public static void TriggerEvent(string eventName, EventMessageObject args)
    {
        UnityEventWithParameter thisEvent = null;

        if (instance.eventDictonary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.Invoke(args);
        }
    }
Beispiel #2
0
    public static void StopListening(string eventName, UnityAction <EventMessageObject> listener)
    {
        if (eventManager == null)
        {
            return;
        }
        UnityEventWithParameter thisEvent = null;

        if (instance.eventDictonary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.RemoveListener(listener);
        }
    }
Beispiel #3
0
    public static void StartListening(string eventName, UnityAction <EventMessageObject> listener)
    {
        UnityEventWithParameter thisEvent = null;

        if (instance.eventDictonary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.AddListener(listener);
        }
        else
        {
            thisEvent = new UnityEventWithParameter();
            thisEvent.AddListener(listener);
            instance.eventDictonary.Add(eventName, thisEvent);
        }
    }