Class EntityContextCastProjectionGameAction<TProjectedContext>
- Assembly
- com.electricdrill.astra-rpg-framework.Runtime.dll
Attempts to narrow an IHasEntity payload to a more specific context type and, if the runtime type matches, forwards the original payload to the wrapped action. Use this when subscribing a broad entity-based event pipeline to actions that only make sense for richer payloads such as damage or death contexts.
public abstract class EntityContextCastProjectionGameAction<TProjectedContext> : GameAction<IHasEntity>, IExecutable<IHasEntity>, ITaggable where TProjectedContext : class, IHasEntity
Type Parameters
TProjectedContextThe target payload type expected by the wrapped action.
- Inheritance
-
objectEntityContextCastProjectionGameAction<TProjectedContext>
- Implements
- Inherited Members
Methods
ExecuteAsync(IHasEntity, CancellationToken)
Executes the action asynchronously with the provided context. Override this method to implement your action logic.
public override Awaitable ExecuteAsync(IHasEntity context, CancellationToken cancellationToken = default)
Parameters
contextIHasEntityThe context object containing information needed for execution.
cancellationTokenCancellationTokenToken to cancel the operation. MonoBehaviour owners can use their "destroyCancellationToken" to automatically cancel when destroyed.
Returns
- Awaitable
An Awaitable that completes when the action finishes.
ExecuteWithOwnerAsync(IHasEntity, MonoBehaviour, CancellationToken)
Owner-aware execution path. The runtimeOwner identifies the
MonoBehaviour (typically a listener or runner) whose entity is the logical owner of this
action invocation. Wrapper actions must override this to forward the owner to children.
The default implementation ignores the owner and delegates to ExecuteAsync(TContext, CancellationToken), so leaf actions that do not need owner information require no changes.
public override Awaitable ExecuteWithOwnerAsync(IHasEntity context, MonoBehaviour runtimeOwner, CancellationToken cancellationToken = default)
Parameters
contextIHasEntityThe context object containing information needed for execution.
runtimeOwnerMonoBehaviourThe MonoBehaviour that owns this action invocation at runtime. Used by conditional actions to populate
EvaluationContext.Holder.cancellationTokenCancellationTokenToken to cancel the operation.
Returns
- Awaitable
An Awaitable that completes when the action finishes.