public static void TriggerEvent(CustomEventType eventType, Object actionObject)
 {
     if (!isApplicationQuitting)
     {
         CustomUnityEvent unityEvent = null;
         if (Instance.eventDictionary.TryGetValue(eventType, out unityEvent))
         {
             unityEvent.Invoke(actionObject);
         }
     }
 }
Exemplo n.º 2
0
    void Awake()
    {
        if (ON_BURIED_FRACTAL == null)
        {
            ON_BURIED_FRACTAL = new CustomUnityEvent();
        }
        IDistanceFunc disfun = _DistanceFuncObj.GetComponent <IDistanceFunc>();

        _fractalDistFunc = disfun.DistanceFunction;
        _radius          = GetComponent <SphereCollider>().radius;
    }
    public static void StartListening(CustomEventType eventType, UnityAction <Object> listener)
    {
        CustomUnityEvent unityEvent = null;

        if (!Instance.eventDictionary.TryGetValue(eventType, out unityEvent))
        {
            unityEvent = new CustomUnityEvent();
            Instance.eventDictionary.Add(eventType, unityEvent);
        }

        unityEvent.AddListener(listener);
    }
    public static void StopListening(CustomEventType eventType, UnityAction <Object> listener)
    {
        if (eventManager == null)
        {
            return;
        }

        CustomUnityEvent unityEvent = null;

        if (Instance.eventDictionary.TryGetValue(eventType, out unityEvent))
        {
            unityEvent.RemoveListener(listener);
        }
    }