class

PointClickEngine::Characters::CharacterStateManager

Inherits Reference < Object

Manages character state transitions and state-dependent behavior

The CharacterStateManager centralizes all state-related logic including:

  • State transition validation and execution
  • State-dependent behavior coordination
  • State change notifications and callbacks
  • State consistency enforcement

Constructors

Instance methods

add_transition_rule(from : CharacterState, to : CharacterState)

Adds custom transition rule

Source
available?

Checks if character is available for interaction

Source
busy?

Checks if character is busy (cannot be interrupted)

Source
can_interact?

Checks if character can interact

Source
can_move?

Checks if character is in a movement-capable state

Source
can_talk?

Checks if character can talk

Source
can_transition_to?(target_state : CharacterState) : Bool

Checks if character can transition to a specific state

Source
create_snapshot

Creates a state snapshot for saving/loading

Source
direction

Current facing direction

Source
direction=(direction : Direction)

Current facing direction

Source
direction_description

Gets direction description

Source
force_idle

Forces character to idle state

Source
force_talking

Forces character to talking state

Source
force_walking

Forces character to walking state

Source
mood

Current emotional mood

Source
mood=(mood : CharacterMood)

Current emotional mood

Source
mood_description

Gets mood description

Source
moving?

Checks if character is currently moving

Source
on_direction_changed
Source
on_direction_changed=(on_direction_changed : Proc(Direction, Direction, Nil) | Nil)
Source
on_mood_changed
Source
on_mood_changed=(on_mood_changed : Proc(CharacterMood, CharacterMood, Nil) | Nil)
Source
on_state_changed

Callbacks for state changes

Source
on_state_changed=(on_state_changed : Proc(CharacterState, CharacterState, Nil) | Nil)

Callbacks for state changes

Source
remove_transition_rule(from : CharacterState, to : CharacterState)

Removes custom transition rule

Source
reset_transition_rules

Resets to default transition rules

Source
restore_from_snapshot(snapshot : Hash(String, String))

Restores state from snapshot

Source
set_direction(new_direction : Direction)

Changes character direction

Source
set_mood(new_mood : CharacterMood)

Changes character mood

Source
set_state(new_state : CharacterState, force : Bool = false) : Bool

Changes character state with validation

Source
state

Current character state

Source
state=(state : CharacterState)

Current character state

Source
state_description

Gets state description for debugging

Source
talking?

Checks if character is currently talking

Source
try_return_to_idle

Attempts to return to idle state from any state

Source
valid_transitions_from_current

Gets all valid transitions from current state

Source
validate_state

Validates current state consistency

Source