State
State describes what character is currently doing, it’s behavior.
Let's describe few of them.
- Idle - when character is not doing anything special, maybe just standing still or running around
- Disabled - when character is stunned/backstabbed or some kind of that behavior
- Backstabbing - when character performs backstab action
- Falling - actually this state is not being used, use IsFalling from MovementComponent instead to check whether character is falling or not
Whenever state changes, event dispatcher OnStateChanged is called, so if we want to do something when character enters or leaves a state we should assign event to that dispatcher.
As an example let's take a look at BP_CombatCharacter.
Summarizing state helps us to determine what we can and what we can’t do.
Few Examples
- Character can only attack / roll when state is Idle.
- Character can’t use any item when it’s state is Disabled etc.