Module Adam
Entry point for Defold-Adam.
Create StateInstances and AdamInstances here
Functions
state(...) | Create new instance of State |
new(initial_state[, transitions[, variables[, final_state]]]) | Create new instance of Adam |
parse(json_data) | Return new Adam Instance from JSON representation |
actions(...) | Return the group of actions what can be used instead single action. |
event(event_name) | Trigger event for all current Adam Instances |
Functions
- state(...)
-
Create new instance of State
Parameters:
- ... ActionInstance The any amount of ActionInstance for this State
Returns:
-
StateInstance
- new(initial_state[, transitions[, variables[, final_state]]])
-
Create new instance of Adam
Parameters:
- initial_state StateInstance The initial FSM state. It will be triggered on start
- transitions StateInstance[] The array of next structure: {state_instance, state_instance, [event]}, describe transitiom from first state to second on event. By default event is adam.FINISHED (optional)
- variables table Defined FSM variables. All variables should be defined before use (optional)
- final_state StateInstance This state should contains only instant actions, execute on adam:final, transitions are not required (optional)
Returns:
-
AdamInstance
- parse(json_data)
-
Return new Adam Instance from JSON representation
Parameters:
- json_data string The Adam Instance JSON representation
Returns:
-
AdamInstance
The new Adam Instance
- actions(...)
-
Return the group of actions what can be used instead single action.
Use it as template actions
Parameters:
- ... ActionInstance The Actions for template
Returns:
-
ActionInstance
Structure what can be used instead single action in state description
- event(event_name)
-
Trigger event for all current Adam Instances
Parameters:
- event_name string