Class ToggleHarvestedExpSourceGameAction<TContext>
- Namespace
- ElectricDrill.AstraRpgFramework.GameActions.Actions
- Assembly
- com.electricdrill.astra-rpg-framework.Runtime.dll
Base generic game action for toggling the harvested state of ExpSource components. Sets the Harvested flag based on the _enable field, allowing control over whether the experience source can be collected.
public abstract class ToggleHarvestedExpSourceGameAction<TContext> : GameAction<TContext>, IExecutable<TContext> where TContext : Component
Type Parameters
TContextThe context type that must be a Component with ExpSource.
- Inheritance
-
objectGameAction<TContext>ToggleHarvestedExpSourceGameAction<TContext>
- Implements
-
IExecutable<TContext>
- Derived
- Inherited Members
Methods
ExecuteAsync(TContext, CancellationToken)
Executes the toggle harvest logic asynchronously. Attempts to get ExpSource from the context and sets its Harvested flag based on _enable.
public override Awaitable ExecuteAsync(TContext context, CancellationToken cancellationToken = default)
Parameters
contextTContextThe context component, expected to have or be ExpSource.
cancellationTokenCancellationTokenToken to cancel the operation.
Returns
- Awaitable
An Awaitable that completes when the toggle operation finishes.