Exemple #1
0
    // In any code: EventManager.StartListening("party", CALLBACK_NAME);
    public static void StartListening(string eventName, UnityAction <int> listener)
    {
        UnityEvent <int> thisEvent = null;

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