Last updated
Last updated
You can use the Parallel Run SM to run as many states and actions at the same time as you want to, anywhere in your program.
First you will create the enum with your states
Then, create your builder, notated on the first line, this will instantiate the State Machine and make it ready to start running
Then use the .state and .enter in order to add the state to the action and corresponding state
Add a function into the .onEnter function and it will run it
Using the .start() method will start the SM and make the .isRunning() method to true
Then call .update() every time in your code and it will automatically run the SM and do all the actions provided
Finally, add a condition to the .stopRunning method that will make it exit when true. You can also add a timeout to the builder.build() method in order to make sure nothing breaks completely