KSP API
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
EventData< T, U, V > Class Template Reference

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, U, V >.OnEvent evt)
 Add a method to be run when the EventData is fired. More...
 
void Fire (T data0, U data1, V data2)
 Triggers the EventData More...
 
void Remove (EventData< T, U, V >.OnEvent evt)
 Remove a method from the list of methods to be run when the EventData is fired. More...
 
delegate void OnEvent (T data0, U data1, V data2)
 Any methods added to the event must match the delegate's parameters; three parameters of the given types in this case. More...
 

Static Public Member Functions

static bool AddEventScene (string eventName, EventData< T, U, V >.OnEvent evt, bool addToAll)
 
static bool AddEventUpwards (Transform transform, string eventName, EventData< T, U, V >.OnEvent evt, bool addToAll)
 
static EventData< T, U, V > FindEventScene (string eventName)
 
static List< EventData< T, U, V > > FindEventsScene (string eventName)
 
static List< EventData< T, U, V > > FindEventsUpwards (Transform transform, string eventName)
 
static EventData< T, U, V > FindEventUpwards (Transform transform, string eventName)
 
static bool RemoveEventScene (string eventName, EventData< T, U, V >.OnEvent evt, bool removeFromAll)
 
static bool RemoveEventUpwards (Transform transform, string eventName, EventData< T, U, V >.OnEvent evt, bool removeFromAll)
 

Public Attributes

bool debugEvent
 Generate debug logs if true More...
 

Detailed Description

A type used to generate GameEvents

Use this type with three accompanying parameters

Template Parameters
TThe first type to be passed through on EventData.Fire()
UThe second type to be passed through on EventData.Fire()
VThe third type to be passed through on EventData.Fire()

Constructor & Destructor Documentation

EventData< T, U, V >.EventData ( string  eventName)

The constructor used to create a new EventData

EventData<Vessel, CelestialBody, String> myNewEvent = new EventData<Vessel, CelestialBody, String>("myNewEvent");

Parameters
eventNameGive the event a string name, generally the same as the declared name

Member Function Documentation

void EventData< T, U, V >.Add ( EventData< T, U, V >.OnEvent  evt)

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));

Parameters
evtThe method you want to add; must contain three parameters matching the types of in the host EventData
static bool EventData< T, U, V >.AddEventScene ( string  eventName,
EventData< T, U, V >.OnEvent  evt,
bool  addToAll 
)
static
static bool EventData< T, U, V >.AddEventUpwards ( Transform  transform,
string  eventName,
EventData< T, U, V >.OnEvent  evt,
bool  addToAll 
)
static
static EventData<T, U, V> EventData< T, U, V >.FindEventScene ( string  eventName)
static
static List<EventData<T, U, V> > EventData< T, U, V >.FindEventsScene ( string  eventName)
static
static List<EventData<T, U, V> > EventData< T, U, V >.FindEventsUpwards ( Transform  transform,
string  eventName 
)
static
static EventData<T, U, V> EventData< T, U, V >.FindEventUpwards ( Transform  transform,
string  eventName 
)
static
void EventData< T, U, V >.Fire ( data0,
data1,
data2 
)

Triggers the EventData

All of the methods added using Add are run after this.

Parameters
data0A parameter matching the first type of the host EventData Use this to give information relevant to the event
data1The second type of the host EventData
data2The third type of the host EventData
delegate void EventData< T, U, V >.OnEvent ( data0,
data1,
data2 
)

Any methods added to the event must match the delegate's parameters; three parameters of the given types in this case.

Parameters
data0
data1
data2
void EventData< T, U, V >.Remove ( EventData< T, U, V >.OnEvent  evt)

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.

Parameters
evtThe method you want to remove; must contain three parameters matching the types of in the host EventData
static bool EventData< T, U, V >.RemoveEventScene ( string  eventName,
EventData< T, U, V >.OnEvent  evt,
bool  removeFromAll 
)
static
static bool EventData< T, U, V >.RemoveEventUpwards ( Transform  transform,
string  eventName,
EventData< T, U, V >.OnEvent  evt,
bool  removeFromAll 
)
static

Member Data Documentation

bool EventData< T, U, V >.debugEvent

Generate debug logs if true


The documentation for this class was generated from the following file: