Class EventListener
Used for listening in on any events sent from and to objects in the game. Also works with PlaymakerFSM events
Namespace: WeaverCore
Assembly: WeaverCore.dll
Syntax
public class EventListener : MonoBehaviour
Methods
| Edit this page View SourceAwake()
Declaration
protected virtual void Awake()
ListenForEvent(string, EventListenerDelegate)
Listens for a specific event fired from any object
Declaration
public uint ListenForEvent(string eventName, EventListener.EventListenerDelegate action)
Parameters
Type | Name | Description |
---|---|---|
string | eventName | The event to listen for |
EventListener.EventListenerDelegate | action | The action that is called when the event is fired |
Returns
Type | Description |
---|---|
uint | Returns the unique id for the listener. This ID can be used to remove the listener via RemoveListener(uint) |
ListenForEvent(EventListenerWithNameDelegate)
Adds an event listener to listen for an event
Declaration
public uint ListenForEvent(EventListener.EventListenerWithNameDelegate action)
Parameters
Type | Name | Description |
---|---|---|
EventListener.EventListenerWithNameDelegate | action | The action to be triggered when an event is fired |
Returns
Type | Description |
---|---|
uint |
|
OnDestroy()
Declaration
protected virtual void OnDestroy()
OnDisable()
Declaration
protected virtual void OnDisable()
OnEnable()
Declaration
protected virtual void OnEnable()
OnEventSent(string, GameObject, GameObject, EventType)
Triggered when any event gets sent
Declaration
protected virtual void OnEventSent(string eventName, GameObject source, GameObject destination, EventManager.EventType eventType)
Parameters
Type | Name | Description |
---|---|---|
string | eventName | The event that was sent |
GameObject | source | The object sending the event |
GameObject | destination | The object receiving the event |
EventManager.EventType | eventType | The type of event that was sent |
RemoveListener(uint)
Removes a listener from listening to a certain event
Declaration
public void RemoveListener(uint ID)
Parameters
Type | Name | Description |
---|---|---|
uint | ID | The id of the listener to remove |