Table of Contents

Class ResurrectEntityGameActionSO<TContext>

Namespace
ElectricDrill.AstraHealth.GameActions.Actions
Assembly
com.electricdrill.astra-health.Runtime.dll

Base generic game action for resurrecting entities with EntityHealth components. Can be configured to resurrect with either a percentage of max HP or a flat HP amount. Uses the default resurrection source from config and no healer entity (system action).

Connect to any GameEventListener whose payload implements ElectricDrill.AstraRpgFramework.Contexts.IHasEntity, such as EntityDiedGameEventListener, DamageResolutionGameEventListener, or directly from an EntityHealth reference.

public abstract class ResurrectEntityGameActionSO<TContext> : GameAction<TContext>, IExecutable<TContext>, ITaggable where TContext : IHasEntity

Type Parameters

TContext

The context type that must implement ElectricDrill.AstraRpgFramework.Contexts.IHasEntity.

Inheritance
object
GameActionBase
GameAction<TContext>
ResurrectEntityGameActionSO<TContext>
Implements
IExecutable<TContext>
ITaggable
Derived
Inherited Members
GameAction<TContext>.Tags
GameAction<TContext>.DisplayName
GameAction<TContext>.ExecuteAsyncForUnityEvent(TContext)
GameAction<TContext>.OnOperationCanceled()

Fields

_flatHpToRecover

[SerializeField]
[Tooltip("Flat amount of HP to restore on resurrection (used when 'Use Percentage HP' is false)")]
protected long _flatHpToRecover

Field Value

long

_percentageHpToRecover

[SerializeField]
[Tooltip("The percentage of max HP to restore (0-100)")]
[Range(0, 100)]
protected int _percentageHpToRecover

Field Value

int

_usePercentageHp

[SerializeField]
[Tooltip("If true, resurrect with a percentage of max HP. If false, use flat HP amount.")]
protected bool _usePercentageHp

Field Value

bool

Methods

ExecuteAsync(TContext, CancellationToken)

Executes the resurrection logic asynchronously. Attempts to get EntityHealth from the context and resurrects with configured HP settings.

public override Awaitable ExecuteAsync(TContext context, CancellationToken cancellationToken = default)

Parameters

context TContext

The context, expected to be or carry an entity that has EntityHealth.

cancellationToken CancellationToken

Token to cancel the operation.

Returns

Awaitable

An Awaitable that completes when resurrection finishes.