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
|
Methods
void |
add_transition ( LimboState from_state, LimboState to_state, StringName event ) |
get_active_state ( ) const |
|
get_leaf_state ( ) const |
|
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
LimboState anystate ( )
Useful for defining a transition from any state.
LimboState initial_state
void set_initial_state ( LimboState value )
LimboState get_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
void set_update_mode ( UpdateMode value )
UpdateMode get_update_mode ( )
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.