Beispiel #1
0
    public static void TriggerEvent(GameData.Event eventName, int firstValue, int secondValue)
    {
        UnityEvent2Int thisEvent = null;

        if (Instance.eventDictionary2Int.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.Invoke(firstValue, secondValue);
        }
    }
Beispiel #2
0
    public static void StopListening(GameData.Event eventName, UnityAction <int, int> listener)
    {
        if (EventManager.Instance == null)   //au cas ou on a déja supprimé l'eventManager
        {
            return;
        }
        UnityEvent2Int thisEvent = null;

        //si on veut unregister et que la clé existe dans le dico..
        if (Instance.eventDictionary2Int.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.RemoveListener(listener);
        }
    }
Beispiel #3
0
    public static void StartListening(GameData.Event eventName, UnityAction <int, int> listener)
    {
        if (!Instance)
        {
            return;
        }

        UnityEvent2Int thisEvent = null;

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