Show / Hide Table of Contents

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

Inheritance
object
Object
Component
Behaviour
MonoBehaviour
EventManager
Namespace: WeaverCore
Assembly: WeaverCore.dll
Syntax
public sealed class EventManager : MonoBehaviour

Methods

| Edit this page View Source

AddReceiverForEvent(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

| Edit this page View Source

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

| Edit this page View Source

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

| Edit this page View Source

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

| Edit this page View Source

ClearAllReceivers()

Clears all event receivers

Declaration
public void ClearAllReceivers()
| Edit this page View Source

ClearReceiversForEvent(string)

Clears all receivers for a particular event name

Declaration
public void ClearReceiversForEvent(string eventName)
Parameters
Type Name Description
string eventName
| Edit this page View Source

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

| Edit this page View Source

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

| Edit this page View Source

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 Source

OnEventTriggered

Called anytime an event is triggered anywhere

Declaration
public static event EventManager.EventTriggeredDelegate OnEventTriggered
Event Type
Type Description
EventManager.EventTriggeredDelegate
| Edit this page View Source

OnReceivedEvent

Called whenever this gameObject receives an event

Declaration
public event EventManager.EventReceiveDelegate OnReceivedEvent
Event Type
Type Description
EventManager.EventReceiveDelegate

Extension Methods

ReflectionUtilities.ReflectCallMethod(object, string, object[], BindingFlags)
ReflectionUtilities.ReflectGetField(object, string, BindingFlags)
ReflectionUtilities.ReflectGetMethod(object, string, BindingFlags)
ReflectionUtilities.ReflectGetProperty(object, string, BindingFlags)
ReflectionUtilities.ReflectSetField(object, string, object, BindingFlags)
ReflectionUtilities.ReflectSetProperty(object, string, object, BindingFlags)
CoroutineUtilities.RunCoroutineWhile<T>(T, IEnumerator, Func<bool>)
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Generated by DocFX
☀
☾