2 using UnityEngine.Events;
3 using System.Collections;
4 using System.Collections.Generic;
17 this.objEvent = objEvent;
26 private Dictionary< Event, ObjectEvent> mEventDictionary;
27 private static List<EventTupel> savedEvents =
new List<EventTupel>();
88 if (mInstance == null) {
101 if (
instance.mEventDictionary.TryGetValue(eventType, out thisEvent))
103 thisEvent.AddListener(listener);
107 thisEvent.AddListener(listener);
108 instance.mEventDictionary.Add(eventType, thisEvent);
116 if (mInstance == null)
122 if (
instance.mEventDictionary.TryGetValue(eventType, out thisEvent))
124 thisEvent.RemoveListener(listener);
128 public static void triggerEvent(
Event eventType,
object obj = null )
133 if (
instance.mEventDictionary.TryGetValue(eventType, out thisEvent))
139 savedEvents.Add(
new EventTupel(thisEvent, obj));
147 public static void executeSavedEvents()
149 if (savedEvents.Count == 0)
154 List<EventTupel> savedEventsCopy =
new List<EventTupel>(savedEvents);
159 e.objEvent.Invoke(e.obj);
165 if( mEventDictionary == null )
167 mEventDictionary =
new Dictionary< Event, ObjectEvent >();
static void stopListening(Event eventType, UnityAction< object > listener)
static PatientEventSystem instance
static void startListening(Event eventType, UnityAction< object > listener)