Ejemplo n.º 1
0
    public static void TriggerEvent(FloatEventName eventName, float argument)
    {
        UnityEvent <float> thisEvent = null;

        if (Instance.m_eventWithFloatDictionary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.Invoke(argument);
        }
    }
Ejemplo n.º 2
0
    public static void StopListening(FloatEventName eventName, UnityAction <float> listener)
    {
        if (m_eventManager == null)
        {
            return;
        }

        UnityEvent <float> thisEvent = null;

        if (Instance.m_eventWithFloatDictionary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.RemoveListener(listener);
        }
    }
Ejemplo n.º 3
0
    public static void StartListening(FloatEventName eventName, UnityAction <float> listener)
    {
        UnityEvent <float> thisEvent = null;

        if (Instance.m_eventWithFloatDictionary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.AddListener(listener);
        }
        else
        {
            thisEvent = new FloatEvent();
            thisEvent.AddListener(listener);
            Instance.m_eventWithFloatDictionary.Add(eventName, thisEvent);
        }
    }