Пример #1
0
    void Move()
    {
        float inputValue;

        inputValue = Input.GetAxis(mInput.joystickHorizontal);

        if (mIsTargeting == false && inputValue != 0)
        {
            mCanMove = true;
        }
        else
        {
            mCanMove = false;
        }

        if (mCanMove == true)
        {
            float speed;

            if (b_PhysicsBehavior.GetIsGrounded() == true)
            {
                speed = mNormalSpeed;
            }
            else
            {
                speed = mAirSpeed;
            }

            if (inputValue > 0)
            {
                b_PhysicsBehavior.SetMoving(DIRECTION.RIGHT, speed);
            }
            else
            {
                b_PhysicsBehavior.SetMoving(DIRECTION.LEFT, speed);
            }
        }
        else
        {
            b_PhysicsBehavior.SetMoving(DIRECTION.DEFAULT, 0);
        }
    }
    void UpdateAnimations()
    {
        bool isMoving = b_PhysicsBehavior.GetVelocity().x != 0;

        b_AnimatorBehavior.SetIsMoving(isMoving);

        bool isGrounded = b_PhysicsBehavior.GetIsGrounded();

        b_AnimatorBehavior.SetIsGrounded(isGrounded);

        b_AnimatorBehavior.SetFacingDirection(mFacingDirection);
    }