FiniteStateMachine
FiniteStateMachine copied to clipboard
Self loop in a state
This is more a question than an issue: Is there a way to specify a self loop in a graph?
I don't quite understand what do you mean, can you give more details?
Hi, immagine a situation where you select a piece in a board and go in a state "Piece Selection" from where you can move in a cell in the board, but you could also choose another piece (different from the one you selected), you need to re-enter into the same state (but reinitialize some variables).
Hope this picture helps:
sorry for the quality of the picture.
EDIT:
I think it is possible with this plugin, but the arrows are mixed up in a weird way:
Never made such machine state but this should work fine. Yeah the arrows are not perfect in such case, maybe in the future I will made new ones that are based on the curves
Oh no, I checked the source code it will not work. It's forbidden in code to try to change the state to the same state in which you are already (I don't thing anything will happen when OnAnotherCard transition will be served. You will need to create immediate state for such case... sorry
I think this can be forced by calling the fsm.setState(fsm.getStateID())
(you could do it from inside of your transition when the condition is served). You need to test this however because there might be some side effects. (really haven't predicted this use case when I was writing the plugin)