示例#1
0
    public static void TriggerEvent <Tbase>() where Tbase : UnityEvent, new()
    {
        UnityEventBase thisEvent = null;

        if (Get().eventDict.TryGetValue(typeof(Tbase), out thisEvent))
        {
            Tbase e = (Tbase)thisEvent;
            if (e != null)
            {
                e.Invoke();
            }
        }
    }
    public static void TriggerEvent <Tbase>() where Tbase : UnityEvent
    {
        UnityEventBase thisEvent = null;

        if (instance.eventDictionary.TryGetValue(typeof(Tbase), out thisEvent))
        {
            Tbase e = thisEvent as Tbase;

            if (e != null)
            {
                e.Invoke();
            }
            else
            {
                Debug.LogError("EventManager.TriggerEvent() FAILED! Event type " + typeof(Tbase).ToString() + " could not be accessed for some strange reason.");
            }
        }
    }