Table of Contents

Class ParameterlessGameEventTrigger

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

IReactiveTrigger that wraps a parameterless GameEvent SO. When the event fires, every registered callback for every holder is invoked with null as the payload.

This class is [Serializable] so it can be embedded as a field in any ScriptableObject or MonoBehaviour. The subscription dictionary is runtime-only and is initialized lazily (safe after Unity deserialization).

[Serializable]
[TypeSelectableMenu("Generic")]
public class ParameterlessGameEventTrigger : IReactiveTrigger
Inheritance
object
ParameterlessGameEventTrigger
Implements

Properties

EventSource

Returns the underlying shared event object this trigger wraps, or null. Triggers returning the same non-null reference are coalesced into a single subscription per modifier instance so that effects always process before duration bookkeeping within the same event raise.

public object EventSource { get; }

Property Value

object

PayloadType

The System.Type of the payload delivered by this trigger when it fires.

typeof(void) for parameterless triggers (no payload); a concrete or interface type for triggers that carry typed event data. Used by ConditionCompatibility to verify that a paired Condition can consume the payload at design time.

public Type PayloadType { get; }

Property Value

Type

Methods

Subscribe(EntityCore, Action<object>)

Registers callback to be invoked when the trigger fires. Multiple distinct callbacks may be registered for the same holder. Registering the exact same callback reference for the same holder a second time is a no-op (idempotent).

public void Subscribe(EntityCore holder, Action<object> callback)

Parameters

holder EntityCore

The entity on whose behalf the subscription is registered. Used as a key to allow grouped removal, but does not filter which events are delivered.

callback Action<object>

Invoked with the event payload boxed as object (may be null for parameterless triggers). The caller is responsible for casting to the expected type.

Unsubscribe(EntityCore, Action<object>)

Removes the subscription for the specific holder/callback pair. Safe to call even if the pair was never registered or has already been removed.

public void Unsubscribe(EntityCore holder, Action<object> callback)

Parameters

holder EntityCore
callback Action<object>