rex_gfsm
This fsm plugin is a framework which could separate the execution into states (i.e. stages), and split the input, logic, output into three parts.
States
Each state is defined by a string, the execution flow will become the changing of states. Each state could has its own transition logic and transition actions.
Each state is defined by a string, the execution flow will become the changing of states. Each state could has its own transition logic and transition actions.
Initial state
The initial state could be assign at "Initial state" in properties table, or call "Action:Go to state" in event sheet.
The different is, "Action:Go to state" will trigger transition actions because that the state has been changed by this action. But "Initial state" will not.
The initial state could be assign at "Initial state" in properties table, or call "Action:Go to state" in event sheet.
The different is, "Action:Go to state" will trigger transition actions because that the state has been changed by this action. But "Initial state" will not.
Input, logic, and output
Input
The input comes from touch or keyboard, or other trigger conditions usually. Call "Action:Request", or "Action:Go to state" to push the state changing of this fsm object.
The different between "Action:Request" and "Action:Go to state" is -
The input comes from touch or keyboard, or other trigger conditions usually. Call "Action:Request", or "Action:Go to state" to push the state changing of this fsm object.
The different between "Action:Request" and "Action:Go to state" is -
- "Action:Request" will trigger the transition logic of current state, the new state (i.e. next state) will be assign in the transition logic.
- "Action:Go to state" will change state directly without trigger the transition logic. It could be used for assigning initial state.
Logic
The transition logic is defined by "Condition:On transfer logic" which is triggered by "Action:Request". It is used to assign the next state by "Action:Set next state" under some conditions.
It is better to put the state changing only at this transition logic to keep the code clearly.
The transition logic is defined by "Condition:On transfer logic" which is triggered by "Action:Request". It is used to assign the next state by "Action:Set next state" under some conditions.
It is better to put the state changing only at this transition logic to keep the code clearly.
Output
After state changed, this fsm object will try to trigger some conditions to execute transition actions, which is the output of this fsm object.
After state changed, this fsm object will try to trigger some conditions to execute transition actions, which is the output of this fsm object.
- "Condition:On transfer": it is used for specific state changing form previous state to current state. It is also the first priority of other triggered conditions. i.e. the triggering procedure will be stopped if this condition has been triggered,
- "Condition:On exit" , "Condition:On enter": they are used to to define the transition actions followed by specific state. they are the second priority.
- "Condition:On default exit" , "Condition:On default enter": they are the last priority.
Debug
Dump current state by "Expression:CurState" under "Condition:On state changed", to track the state changing. It is better to make sure the state changing is correct first.
Dump current state by "Expression:CurState" under "Condition:On state changed", to track the state changing. It is better to make sure the state changing is correct first.