KSP API
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
EventVoid Class Reference

A type used to generate GameEvents More...

Public Member Functions

 EventVoid (string eventName)
 The constructor used to create a new EventVoid More...
 
void Add (EventVoid.OnEvent evt)
 Add a method to be run when the EventVoid is fired. More...
 
void Fire ()
 Triggers the EventVoid More...
 
void Remove (EventVoid.OnEvent evt)
 Remove a method from the list of methods to be run when the EventVoid is fired. More...
 
delegate void OnEvent ()
 Any methods added to the event must match the delegate's parameters; none in this case More...
 

Static Public Member Functions

static bool AddEventScene (string eventName, EventVoid.OnEvent evt, bool addToAll)
 
static bool AddEventUpwards (Transform transform, string eventName, EventVoid.OnEvent evt, bool addToAll)
 
static EventVoid FindEventScene (string eventName)
 
static List< EventVoidFindEventsScene (string eventName)
 
static List< EventVoidFindEventsUpwards (Transform transform, string eventName)
 
static EventVoid FindEventUpwards (Transform transform, string eventName)
 
static bool RemoveEventScene (string eventName, EventVoid.OnEvent evt, bool removeFromAll)
 
static bool RemoveEventUpwards (Transform transform, string eventName, EventVoid.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 when there is no need to accompany the event with any parameters, ie relevant Part, Vessel, CelestialBody, etc...

See EventData for events that require such extra information

Constructor & Destructor Documentation

EventVoid.EventVoid ( string  eventName)

The constructor used to create a new EventVoid

EventVoid myNewEvent = new EventVoid("myNewEvent");

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

Member Function Documentation

void EventVoid.Add ( EventVoid.OnEvent  evt)

Add a method to be run when the EventVoid is fired.

This is generally done in an object's Start or Awake method, or a class' constructor.

Can be setup like:

GameEvents.someEventVoidEvent.Add(yourMethod);

or

GameEvents.someEventVoidEvent.Add(new EventVoid.OnEvent(yourMethod));

Parameters
evtThe method you want to add, should contain no parameters
static bool EventVoid.AddEventScene ( string  eventName,
EventVoid.OnEvent  evt,
bool  addToAll 
)
static
static bool EventVoid.AddEventUpwards ( Transform  transform,
string  eventName,
EventVoid.OnEvent  evt,
bool  addToAll 
)
static
static EventVoid EventVoid.FindEventScene ( string  eventName)
static
static List<EventVoid> EventVoid.FindEventsScene ( string  eventName)
static
static List<EventVoid> EventVoid.FindEventsUpwards ( Transform  transform,
string  eventName 
)
static
static EventVoid EventVoid.FindEventUpwards ( Transform  transform,
string  eventName 
)
static
void EventVoid.Fire ( )

Triggers the EventVoid

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

delegate void EventVoid.OnEvent ( )

Any methods added to the event must match the delegate's parameters; none in this case

void EventVoid.Remove ( EventVoid.OnEvent  evt)

Remove a method from the list of methods to be run when the EventVoid is fired.

This is generally done in an object's OnDestroy method.

Parameters
evtThe method you want to remove, should contain no parameters
static bool EventVoid.RemoveEventScene ( string  eventName,
EventVoid.OnEvent  evt,
bool  removeFromAll 
)
static
static bool EventVoid.RemoveEventUpwards ( Transform  transform,
string  eventName,
EventVoid.OnEvent  evt,
bool  removeFromAll 
)
static

Member Data Documentation

bool EventVoid.debugEvent

Generate debug logs if true


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