![]() |
VOOZH | about |
A state machine controls which behavior is active at any time. Only one state runs at a time. When conditions change, the machine switches to a different state.
First, create an enum to list all possible states.
Then create a manager script that switches between states.
Output:
Here's a full working example for a player character
For complex games, create separate classes for each state.
And the state machine manager: