Side Attack

Most characters simply flip their Sprite horizontally to turn around, but the Maw Flower enemy can't move and actually has different Sprites for attacking to the left and right, so this state allows it to choose the appropriate animation depending on the direction its Brain is currently trying to move.

The script is very simple, it has two animations and picks one based on the Character.MovementDirectionX:

public sealed class SideAttackState : AttackState
{
    [SerializeField] private AttackTransition _LeftAnimation;
    [SerializeField] private AttackTransition _RightAnimation;

    private void Awake()
    {
        _LeftAnimation.Events.OnEnd += Character.StateMachine.ForceSetDefaultState;
        _RightAnimation.Events.OnEnd += Character.StateMachine.ForceSetDefaultState;
    }

    public override void OnEnterState()
    {
        base.OnEnterState();
        var animation = Character.MovementDirectionX < 0 ? _LeftAnimation : _RightAnimation;
        Character.Animancer.Play(animation);
    }
}