Inspector Fields

FieldTypeDescription
damageStatStatStat asset used to look up the player's damage value from the inventory.
defenseStatStatStat asset used to look up the player's defense value from the inventory.
useItemFXItemUsedFXPrefab spawned to display a floating item icon when an item is used. See ItemUsedFX.
useItemParticlesParticleSystemParticle system played at the player's position during item use.

Properties

PropertyTypeDescription
staminaPlayerStaminaThe PlayerStamina component on this character. Retrieved on Awake.
damageintDamage value read from PlayerInventory using damageStat. Overrides the base class virtual property.
defenseintDefense value read from PlayerInventory using defenseStat. Overrides the base class virtual property.

Events

EventSignatureDescription
OnExecuteAction<ExecutionContext>Fired each time the player executes an instruction. All IExecutionSuscriber components found in the hierarchy during Initialize() subscribe to this automatically.

Methods

MethodDescription
Initialize(ExecutionContext context,
ExecutionContextElement parent)
Sets up the inventory reference, retrieves stamina, and subscribes all IExecutionSuscriber children to OnExecute. Called automatically at level start by the InstructionRunner.
ValidatePosition() → boolReturns true if the player's current tile is a PathTile and is not occupied by an IObstacle.
ValidatePosition(Vector3 position) → boolOverload that validates an arbitrary world position instead of the player's current one.
UseItem(Item item)Spawns the useItemFX prefab at the player's position, plays useItemParticles, then applies the item's effects to all IStatEffectReceiver components on the hierarchy.
PlaySound(AudioResource resource)Stops any currently playing sound and plays the given AudioResource on the character's AudioSource.

Inherited from CharacterInstanceController

The following members are defined on the base class and available on every PlayerController instance:

MemberTypeDescription
positionVector2 (get/set)World-space position of the character. Writing this moves the character instantly.
directionDirectionCurrent facing direction.
healthHealthThe Health component managing hit points and death.
blockingboolWhether the character is currently in a blocking pose. Checked by PlayerHealth before applying damage.
HUDTransformRoot of the in-world HUD elements. Flipped alongside the sprite on direction changes.
SetDirection(Direction direction)Faces the character and flips the sprite and HUD for left/right directions.
PlayAnimation(string stageName)Plays an animator state by name. Does nothing if the character is dead.
ℹ️
Access PlayerController from inside any instruction via context.player. See ExecutionContext for the full player API surface.