Table of Contents

Class EntityContextToComponentProjectionGameAction

Namespace
ElectricDrill.AstraRpgFramework.GameActions.Actions.WithIHasEntity
Assembly
com.electricdrill.astra-rpg-framework.Runtime.dll

Bridges an IHasEntity context to an inner GameAction<TContext> typed on ElectricDrill.AstraRpgFramework.GameActions.Actions.Component, by extracting Entity and passing it as the context. This lets you reuse any existing Component-based action on events that dispatch an IHasEntity payload without duplicating the action implementation.

Trade-off: the inner action receives only the EntityCore component — rich payload data (e.g. damage amounts, level deltas) is discarded. Use this exclusively for structural actions (destroy, toggle renderer, etc.) that only need to know which entity was involved, not what happened to it.

[CreateAssetMenu(fileName = "New Entity Context To Component Projection Action", menuName = "Astra RPG Framework/Game Actions/Context: Entity/Projections/→ Component Projection")]
public class EntityContextToComponentProjectionGameAction : GameAction<IHasEntity>, IExecutable<IHasEntity>, ITaggable
Inheritance
object
EntityContextToComponentProjectionGameAction
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

context IHasEntity

The context object containing information needed for execution.

cancellationToken CancellationToken

Token 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

context IHasEntity

The context object containing information needed for execution.

runtimeOwner MonoBehaviour

The MonoBehaviour that owns this action invocation at runtime. Used by conditional actions to populate EvaluationContext.Holder.

cancellationToken CancellationToken

Token to cancel the operation.

Returns

Awaitable

An Awaitable that completes when the action finishes.