The engine uses a simple state machine controller to handle the current player state.

These states are component that are attached to the player. For and easier visualization they have been split into different objects

https://lh6.googleusercontent.com/zWZlekSrniWEccQeOUTlYs7Z2h95AI8i2fPl5mZUqZkPDvJl4KpDEEqCF83G3oLJINI9qTQit_H1eoLVdVGjR0DGbErVb6WFetR7cHSLosPNpLm8R341-6IOfLSMwwslllbWVANbqP3Uv1GROEoVs4_UtQbe5BXYDtYX44hs2ff1624inF9HcLLd2Q

If needed, more states could be created by inheriting the class ActorState and using the existing methods StateEnter, StateUpdate/StateFixedUpdate and StateExit.

You can make the controller enter this state by calling the method ActorState::SetState.

ActoState component has some variables that allows to set the animation that will be used by the state on enter and exit.

Untitled

AnimationState and ExitAnimationState need AnimatorStateHandles assets. These will indicate which state of the Animator will be used for this state. Learm more about how to create them here.

Additionally, you can specify custom AnimatioStates to use when coming from a specific state by adding elements to the StateTransitions list.

Untitled

Actor state with duration

There is a custom ActoState class that can be used for states that have a specific duration. The component is called ActorStateWithDuration and the state will transition automatically to the state specified on GoToStateAfterDuration.

Untitled

Additionally, you can extend this class and implement OnStateDurationEnd with your custom functionality.

Global Transitions

Sometimes we might want to trigger a specific transitions from any state from outside of state code. For example, when a character gets hurt or killed, we want to trigger an state transition to those states regardless of the current state they’re in.

Untitled

For this, we have the component ActorStateTransition you can specify the state the controller goes to when the transition is triggered and even indicate from what states this transition will take effect.