Class EventManager
Used for receiving events from other objects, and sending events to other objects. This component can also be used to send and receive PlaymakerFSM events
Namespace: WeaverCore
Assembly: WeaverCore.dll
Syntax
public sealed class EventManager : MonoBehaviour
Methods
| Edit this page View SourceAddReceiverForEvent(string, Action)
Executes an action whenever an event with the specified name
is received
Declaration
public void AddReceiverForEvent(string name, Action action)
Parameters
Type | Name | Description |
---|---|---|
string | name | The event name |
Action | action | The action to execute when the event of the specified name is received |
AddReceiverForEvent(string, Action<string, GameObject>)
Executes an action whenever an event with the specified name
is received
Declaration
public void AddReceiverForEvent(string name, Action<string, GameObject> action)
Parameters
Type | Name | Description |
---|---|---|
string | name | The event name |
Action<string, GameObject> | action | The action to execute when the event of the specified name is received. The string parameter is the name of the event received, and the gameObject parameter is the source gameObject |
AddReceiverForEvent(string, Action<GameObject>)
Executes an action whenever an event with the specified name
is received
Declaration
public void AddReceiverForEvent(string name, Action<GameObject> action)
Parameters
Type | Name | Description |
---|---|---|
string | name | The event name |
Action<GameObject> | action | The action to execute when the event of the specified name is received. The gameObject parameter is the source gameObject |
BroadcastEvent(string, GameObject)
Broadcasts an event to all objects in the game
Declaration
public static void BroadcastEvent(string eventName, GameObject source)
Parameters
Type | Name | Description |
---|---|---|
string | eventName | The event to fire |
GameObject | source | The object sending the event |
ClearAllReceivers()
Clears all event receivers
Declaration
public void ClearAllReceivers()
ClearReceiversForEvent(string)
Clears all receivers for a particular event name
Declaration
public void ClearReceiversForEvent(string eventName)
Parameters
Type | Name | Description |
---|---|---|
string | eventName |
SendEventToGameObject(string, GameObject, float, GameObject)
Sends an event to a specific gameObject
Declaration
public static void SendEventToGameObject(string eventName, GameObject destination, float delay, GameObject source = null)
Parameters
Type | Name | Description |
---|---|---|
string | eventName | The event to fire |
GameObject | destination | The object receiving the event |
float | delay | The delay before the event gets sent |
GameObject | source | The object sending the event |
SendEventToGameObject(string, GameObject, GameObject)
Sends an event to a specific gameObject
Declaration
public static void SendEventToGameObject(string eventName, GameObject destination, GameObject source = null)
Parameters
Type | Name | Description |
---|---|---|
string | eventName | The event to fire |
GameObject | destination | The object receiving the event |
GameObject | source | The object sending the event |
TriggerEvent(string, GameObject)
Fires an event on this object
Declaration
public void TriggerEvent(string eventName, GameObject source)
Parameters
Type | Name | Description |
---|---|---|
string | eventName | The event to fire |
GameObject | source | The object that is sending the event |
Events
| Edit this page View SourceOnEventTriggered
Called anytime an event is triggered anywhere
Declaration
public static event EventManager.EventTriggeredDelegate OnEventTriggered
Event Type
Type | Description |
---|---|
EventManager.EventTriggeredDelegate |
OnReceivedEvent
Called whenever this gameObject receives an event
Declaration
public event EventManager.EventReceiveDelegate OnReceivedEvent
Event Type
Type | Description |
---|---|
EventManager.EventReceiveDelegate |