LimboHSM

Inherits: LimboState

Event-based Hierarchical State Machine (HSM).

Description

Event-based Hierarchical State Machine (HSM) that manages LimboState instances and facilitates transitions between them. LimboHSM is a LimboState in itself and can also serve as a child of another LimboHSM node.

Properties

LimboState

ANYSTATE

LimboState

initial_state

UpdateMode

update_mode

1

Methods

void

add_transition ( LimboState from_state, LimboState to_state, StringName event )

LimboState

get_active_state ( ) const

LimboState

get_leaf_state ( ) const

LimboState

get_previous_active_state ( ) const

void

initialize ( Node agent, Blackboard parent_scope=null )

void

set_active ( bool active )

void

update ( float delta )


Signals

active_state_changed ( LimboState current, LimboState previous )

Emitted when the currently active substate is switched to a different substate.


Enumerations

enum UpdateMode:

UpdateMode IDLE = 0

Update the state machine during the idle process.

UpdateMode PHYSICS = 1

Update the state machine during the physics process.

UpdateMode MANUAL = 2

Manually update the state machine by calling update from a script.


Property Descriptions

LimboState ANYSTATE

Useful for defining a transition from any state.


LimboState initial_state

The substate that becomes active when the state machine is activated using the set_active method. If not explicitly set, the first child of the LimboHSM will be considered the initial state.


UpdateMode update_mode = 1

Specifies when the state machine should be updated. See UpdateMode.


Method Descriptions

void add_transition ( LimboState from_state, LimboState to_state, StringName event )

Establishes a transition from one state to another when event is dispatched. Both from_state and to_state must be immediate children of this state.


LimboState get_active_state ( ) const

Returns the currently active substate.


LimboState get_leaf_state ( ) const

Returns the currently active leaf state within the state machine.


LimboState get_previous_active_state ( ) const

Returns the previously active substate.


void initialize ( Node agent, Blackboard parent_scope=null )

Initiates the state and calls LimboState._setup for both itself and all substates.


void set_active ( bool active )

When set to true, switches the state to initial_state and activates state processing according to update_mode.


void update ( float delta )

Calls LimboState._update on itself and the active substate, with the call cascading down to the leaf state. This method is automatically triggered if update_mode is not set to MANUAL.