private void MoveAnimations(Directions dir)
    {
        // Limit to only facing axis directions when moving.
        switch (axis)
        {
        case (Axis.x):
            if (dir == Directions.Up || dir == Directions.Down)
            {
                dir = npc.DefaultFacingDirection;
            }
            break;

        case (Axis.y):
            dir = npc.DefaultFacingDirection;
            break;

        case (Axis.z):
            if (dir == Directions.Right || dir == Directions.Left)
            {
                dir = npc.DefaultFacingDirection;
            }
            break;
        }

        bool isMoving = npc.transform.position != lastPosition;

        if (!isMoving)
        {
            npc.FaceDefaultDirection();
        }
        else
        {
            Script_Utils.AnimatorSetDirection(npc.MyAnimator, dir);
        }
    }
Example #2
0
    void MoveAnimation(Directions dir)
    {
        Directions myFaceDirection = ToOppositeDirectionZ(dir);

        Script_Utils.AnimatorSetDirection(animator, myFaceDirection);

        bool isMoving = Script_Game.Game.GetPlayer().MyAnimator.GetBool(PlayerMovingBool);

        SetIsMoving(isMoving);

        if (positionAdjuster != null)
        {
            positionAdjuster.Adjust(myFaceDirection);
        }
    }