Open KammutierSpule opened 4 years ago
Hi Mario Luzeiro,
The UML state machine explained in Wikipedia or other resources don't have a concept of entry and exit callback for level. The entry and exit actions are for the State.
I couldn't understand the complete hierarchy of your states from your description.
Does the below diagram matches with your description? If yes you can explain your specific requirement based on the below diagram. However, if you post your state diagram it will be useful to understand your requirement.
As shown in the diagram, the state transition from L1S1to L1S4 will be L1S1->L0S0->L1S1->L1S4. And their entry-exit actions flow will be,
L1S1->Exit()
L0S0->Entry()
L0S0->Exit()
L1S1->Entry()
L1S1->Exit()
L1S4->Entry()
Will it be possible to implement your requirement by adding logic inside the entry action of each state? OR Can we solve your problem by rearranging the states and their hierarchy?
Thanks for your answer! I'm not familiar with the UML notation. I made a small change on your diagram:
Each L1 is specific for each L0Sx, there wont be transitions between L1 for different L0Sx states
Will it be possible to implement your requirement by adding logic inside the entry action of each state? OR Can we solve your problem by rearranging the states and their hierarchy?
I have that in mind A possibility would be to implement some internal logic (bool flags etc) that I can use to enter/exit of L0 Another possibility I think would be to use separate and additional State Machines.. like one state machine with just 1 state so I can add the Entry/Exit from Level. So each Level is implemented with a 1 single state State Machine
Hello! Thanks for this nice project and well documented! I didn't tried it yet, I'm learning how could I use it. I am trying to implement the following hierarchical state machine, that I will try explain with ascii code:
So I have at L0 State0 that can switch to L0 S1 (or L0 State N-1), .. but then on each L0 State, I can switch to a new L1 state for each On L1 I will have L1 S0 ->S1->S2->S0.. and then can return to L0 from any point
From this library, there are Entry and Exit callbacks for each state. But I would like to implement an Entry/Exit for each Level So when it enter or exit a Level it will call a function to prepare things for that level
How can I implement an Entry/Exit for a Level?