Overview

ClassBehaviour
Tile_Interactable_PressurePlateDetects when the player or any obstacle stands on its tile and fires OnActivated / OnDeactivated events. Useful for triggering doors, bridges, or any reaction that depends on occupation state.
Tile_Interactable_AppearingSpikesCycles through a configurable array of stages each turn. On spike stages it deals lethal damage to any entity with a Health component on the tile.
ℹ️
Automatic registration Any ExecutionContextElement that also implements ITaskReceiver is discovered and registered automatically during initialization. You do not need to register trap objects manually.

Tile_Interactable_PressurePlate

Checks its tile once per turn — at the halfway point of the turn interval — and transitions between pressed and released states based on whether the player or an IObstacle is present.

Inspector Fields

FieldTypeDescription
OnActivatedUnityEventFired the turn the plate transitions from released to pressed. Wire this to doors, bridges, or any reaction object.
OnDeactivatedUnityEventFired the turn the plate transitions from pressed to released.

Properties

PropertyTypeDescription
currentInstructionInstructionThe instruction currently being executed. Exposed so HUD indicators can display the trap's active action.

ITaskReceiver Events

EventSignatureDescription
OnStartAction<EnemyAction>Raised when the trap's task begins executing for this turn.
OnActionChangeAction<EnemyAction>Raised when transitioning between internal execution stages.
OnEndActionRaised when the trap's task finishes for this turn.
OnExecuteAction<ExecutionContext>Raised each time an execution step runs, providing the current context.

Methods

MethodReturnsDescription
GetTask()TaskReturns the Task the runner should execute this turn. Called automatically by InstructionRunner.
Initialize(
  ExecutionContext context,
  ExecutionContextElement parent)
voidCalled during level initialization. Caches the Animator and sets up the internal CustomInstruction.
💡
Detection logic The plate uses Physics2D.OverlapBoxAll at the halfway point of the turn interval (context.turnInterval × 0.5f). It detects any collider that has either an IObstacle component or a PlayerController component. Pushable objects and carried crates count as obstacles.

Tile_Interactable_AppearingSpikes

Cycles through a configurable stages array each turn. A true entry means spikes are extended and deal lethal damage; false means they are retracted and safe to walk on. The stage advances automatically at the end of each turn.

Inspector Fields

FieldTypeDescription
stagesbool[]Ordered list of spike states. Default is [false, true] — safe on turn 1, lethal on turn 2, repeating. Add more entries to create longer patterns (e.g. [false, false, true] for safe-safe-lethal).

Properties

PropertyTypeDescription
currentInstructionInstructionThe instruction currently being executed. Exposed for HUD display.

ITaskReceiver Events

EventSignatureDescription
OnStartAction<EnemyAction>Raised when the trap's task begins executing for this turn.
OnActionChangeAction<EnemyAction>Raised when transitioning between internal execution stages.
OnEndActionRaised when the trap's task finishes for this turn.
OnExecuteAction<ExecutionContext>Raised each time an execution step runs, providing the current context.

Methods

MethodReturnsDescription
GetTask()TaskReturns the Task the runner should execute this turn.
Initialize(
  ExecutionContext context,
  ExecutionContextElement parent)
voidCalled during level initialization. Caches the Animator and sets up the internal CustomInstruction.
💡
Damage model When a spike stage is active, the trap calls Health.Kill() on every object with a Health component found by Physics2D.OverlapBoxAll on its tile. The check runs mid-turn so the spikes animate before the kill is applied. Entities that move off the tile before the check survives.

Animator Parameters

ClassParameterTypeDescription
Tile_Interactable_PressurePlateActivatedbooltrue while the plate is pressed down.
Tile_Interactable_AppearingSpikesAppearedbooltrue while the spikes are extended.