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

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

        UnityEvent <string> thisEvent = null;

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

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