void UpdateAnimation()
    {
        string newDirection = DirectionType.NONE;

        if (Input.GetKeyDown(KeyCode.W) && _newInput != KeyCode.W)
        {
            newDirection = DirectionType.UP;
            _newAction   = new WalkAction();
            _newInput    = KeyCode.W;
        }
        else if (Input.GetKeyDown(KeyCode.A) && _newInput != KeyCode.A)
        {
            newDirection = DirectionType.LEFT;
            _newAction   = new WalkAction();
            _newInput    = KeyCode.A;
        }
        else if (Input.GetKeyDown(KeyCode.S) && _newInput != KeyCode.S)
        {
            newDirection = DirectionType.DOWN;
            _newAction   = new WalkAction();
            _newInput    = KeyCode.S;
        }
        else if (Input.GetKeyDown(KeyCode.D) && _newInput != KeyCode.D)
        {
            newDirection = DirectionType.RIGHT;
            _newAction   = new WalkAction();
            _newInput    = KeyCode.D;
        }
        else if (Input.GetKeyDown(KeyCode.Space))
        {
            newDirection = _lastDirection;
            _newAction   = new SlashAction();
            _newInput    = KeyCode.Space;
        }
        else if (Input.GetKeyDown(KeyCode.F))
        {
            newDirection = _lastDirection;
            _newAction   = new ThrustAction();
            _newInput    = KeyCode.F;
        }
        else if (Input.GetKeyDown(KeyCode.R))
        {
            newDirection = _lastDirection;
            _newAction   = new SpellcastAction();
            _newInput    = KeyCode.R;
        }
        else if (Input.GetKeyDown(KeyCode.E))
        {
            newDirection = _lastDirection;
            _newAction   = new ShootAction();
            _newInput    = KeyCode.E;
        }
        else
        {
            _newInput = KeyCode.None;
        }

        // continue using the last direction when the character stops moving
        if (newDirection == DirectionType.NONE)
        {
            newDirection = _lastDirection;
        }

        bool sameAction = _lastDirection == newDirection && _lastInput == _newInput;

        if (!sameAction || Player.characterDNA.IsDirty())
        {
            _animationManager.UpdateDNAForAction(Player.characterDNA, Player.animationDNA, _newAction, newDirection);
            _charAnimator.AnimateAction(Player.animationDNA, _newAction);
        }
        else if (!Input.anyKey)
        {
            _charAnimator.StopOnFinalFrame(true);
        }

        _lastDirection = _newAction.Direction = newDirection;
        _lastInput     = _newInput;
    }