A type used to generate GameEvents More...
Public Member Functions | |
EventData (string eventName) | |
The constructor used to create a new EventData More... | |
void | Add (EventData< T >.OnEvent evt) |
Add a method to be run when the EventData is fired. More... | |
void | Fire (T data) |
Triggers the EventData More... | |
void | Remove (EventData< T >.OnEvent evt) |
Remove a method from the list of methods to be run when the EventData is fired. More... | |
delegate void | OnEvent (T data) |
Any methods added to the event must match the delegate's parameters; one parameter of the given type in this case. More... | |
Static Public Member Functions | |
static bool | AddEventScene (string eventName, EventData< T >.OnEvent evt, bool addToAll) |
static bool | AddEventUpwards (Transform transform, string eventName, EventData< T >.OnEvent evt, bool addToAll) |
static EventData< T > | FindEventScene (string eventName) |
static List< EventData< T > > | FindEventsScene (string eventName) |
static List< EventData< T > > | FindEventsUpwards (Transform transform, string eventName) |
static EventData< T > | FindEventUpwards (Transform transform, string eventName) |
static bool | RemoveEventScene (string eventName, EventData< T >.OnEvent evt, bool removeFromAll) |
static bool | RemoveEventUpwards (Transform transform, string eventName, EventData< T >.OnEvent evt, bool removeFromAll) |
Public Attributes | |
bool | debugEvent |
Generate debug logs if true More... | |
A type used to generate GameEvents
Use this type with one accompanying type; GameEvents.FromToAction, GameEvents.HostedFromToAction, GameEvents.HostTargetAction are commonly used
See EventVoid for events that require no parameters or EventReport for a different style
T | The type to be passed through on EventData.Fire() |
EventData< T >.EventData | ( | string | eventName | ) |
Add a method to be run when the EventData is fired.
This is generally done in an object's Start or Awake method, or a class' constructor.
Can be setup like:
GameEvents.someEventDataEvent.Add(yourMethod);
or
GameEvents.someEventDataEvent.Add(new EventVoid.OnEvent(yourMethod));
evt | The method you want to add; must contain a single parameter of the type matching that in the host EventData |
|
static |
|
static |
|
static |
|
static |
void EventData< T >.Fire | ( | T | data | ) |
Triggers the EventData
All of the methods added using Add are run after this.
data | Single parameter matching the type of the host EventData Use this to give information relevant to the event |
delegate void EventData< T >.OnEvent | ( | T | data | ) |
Any methods added to the event must match the delegate's parameters; one parameter of the given type in this case.
data |
Remove a method from the list of methods to be run when the EventData is fired.
This is generally done in an object's OnDestroy method.
evt | The method you want to remove; must contain a single parameter of a type matching that in the host EventData |
|
static |
|
static |
bool EventData< T >.debugEvent |
Generate debug logs if true