public static void emit(EventManagerType emt) { if (onEvent != null) { onEvent(emt); } }
public static void TriggerEvent(EventManagerType eventType) { UnityEvent thisEvent; if (Instance._eventDictionary.TryGetValue(eventType, out thisEvent)) { thisEvent.Invoke(); } }
// iTween.ShakePosition(gameObject, new Vector3(1, 1, 0), 1); /// <summary> /// Effects the specified emt. /// </summary> /// <param name="emt">The emt.</param> void Effect(EventManagerType emt) { switch (emt) { case EventManagerType.FISHEYEBUMP: StartCoroutine(StartToFisheye()); break; case EventManagerType.DASH: StartCoroutine(Dash()); break; } }
public static void StopListening(EventManagerType eventType, UnityAction listener) { // No need create again for remove if (_eventManager == null) { return; } UnityEvent thisEvent; if (_eventManager._eventDictionary.TryGetValue(eventType, out thisEvent)) { thisEvent.RemoveListener(listener); } }
public static void StartListening(EventManagerType eventName, UnityAction listener) { UnityEvent thisEvent; if (Instance._eventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.AddListener(listener); } else { thisEvent = new UnityEvent(); thisEvent.AddListener(listener); Instance._eventDictionary.Add(eventName, thisEvent); } }