Module StateInstance
All state instances created by this class.
Used to describe the states for your FSM. Contain actions what will be triggered.
Functions
initialize(...) | State Instance constructor function |
event(event_name) | Trigger event to FSM. |
is_instant() | Check is State can run in one frame. |
get_adam_instance() | Get the current AdamInstance, attached to this state |
get_id() | Return current State Instance id. |
set_name(name) | Set name for State Instance. |
get_name() | Get name of current State Instance |
set_debug(state) | Set debug state of state. |
Local Functions
update(dt) | State Instance update function. |
trigger() | Execute all state instance actions. |
release() | Execute all state instance release actions. |
get_value(variable_name) | Return variable value from FSM variables. |
set_value(variable_name, value) | Set variable value in action's FSM. |
set_adam_instance(adam_instance) | Set current AdamInstance for this StateInstance |
_on_action_finish() | ActionInstance, triggered by this State, call this callback on finish execution |
_load_actions(actions) | Load list of actions. |
Functions
- initialize(...)
-
State Instance constructor function
Parameters:
- ... ActionInstance The any amount of ActionInstance for this State
Returns:
-
StateInstance
- event(event_name)
-
Trigger event to FSM. If state changed by one of Action, other actions below
of it will not executed
Parameters:
- event_name string The event to send
- is_instant()
-
Check is State can run in one frame. All actions inside this state
are not deferred
Returns:
-
boolean
True, if state triggers in one frame
- get_adam_instance()
-
Get the current AdamInstance, attached to this state
Returns:
-
AdamInstance
- get_id()
- Return current State Instance id. All State's id are unique. Used to build Adam FSM transitions
- set_name(name)
-
Set name for State Instance. Useful for Debug.
Parameters:
- name string The State Instance name
- get_name()
-
Get name of current State Instance
Returns:
-
string
The State Instance name
- set_debug(state)
-
Set debug state of state. If true, will print debug info to console
Parameters:
- state boolean The debug state
Returns:
-
StateInstance
Self
Local Functions
- update(dt)
-
State Instance update function. Called by AdamInstance:update
Parameters:
- dt
- trigger()
- Execute all state instance actions. Called by AdamInstance on enter state callback
- release()
- Execute all state instance release actions. Called by AdamInstance on leave state callback
- get_value(variable_name)
-
Return variable value from FSM variables. Used by ActionInstance
Parameters:
- variable_name string The name of variable in FSM
See also:
- set_value(variable_name, value)
-
Set variable value in action's FSM. Used by ActionInstance
Parameters:
- variable_name string The name of variable in FSM
- value any New value for variable
See also:
- set_adam_instance(adam_instance)
-
Set current AdamInstance for this StateInstance
Parameters:
- adam_instance AdamInstance
- _on_action_finish()
- ActionInstance, triggered by this State, call this callback on finish execution
- _load_actions(actions)
-
Load list of actions. Need to proceed included action templates
Parameters:
- actions ActionInstance[] The list of actions