Table of Contents

Class GameEventGeneric2<T, U>

Namespace
ElectricDrill.AstraRpgFramework.Events
Assembly
com.electricdrill.astra-rpg-framework.Runtime.dll

A generic ScriptableObject-based event system that can carry two parameters of types T and U. Supports both MonoBehaviour-based listeners and code-based Action listeners.

public abstract class GameEventGeneric2<T, U> : GameEventBase<GameEventListenerGeneric2<T, U>, Action<T, U>>, IRaisable<T, U>

Type Parameters

T

The type of the first parameter this event carries.

U

The type of the second parameter this event carries.

Inheritance
object
GameEventGeneric2<T, U>
Implements
IRaisable<T, U>
Inherited Members

Methods

Raise(T, U)

Raises the event with the specified contexts, notifying all registered listeners. Both MonoBehaviour listeners and Action listeners are notified in registration order. Listeners are snapshot before iteration so that subscribe/unsubscribe during a callback does not affect the current raise. The non-reentrant path is allocation-free after warmup.

public virtual void Raise(T context1, U context2)

Parameters

context1 T

The first parameter to pass to all listeners.

context2 U

The second parameter to pass to all listeners.

RegisterListener(GameEventListenerGeneric2<T, U>)

Registers a MonoBehaviour-based listener to be notified when this event is raised. Duplicate listeners are automatically prevented.

public void RegisterListener(GameEventListenerGeneric2<T, U> listener)

Parameters

listener GameEventListenerGeneric2<T, U>

The GameEventListenerGeneric2 to register.

UnregisterListener(GameEventListenerGeneric2<T, U>)

Unregisters a MonoBehaviour-based listener so it will no longer be notified when this event is raised.

public void UnregisterListener(GameEventListenerGeneric2<T, U> listener)

Parameters

listener GameEventListenerGeneric2<T, U>

The GameEventListenerGeneric2 to unregister.

Events

OnEventRaised

Event that can be subscribed to from code using standard C# event syntax. Automatically handles registration and unregistration of Action listeners.

public virtual event Action<T, U> OnEventRaised

Event Type

Action<T, U>