void FixedUpdate()
    {
        if (isTalking)
        {
            spriteMover.pauseMoving();
            return;
        }

        right   = Input.GetAxisRaw("Horizontal");
        forward = Input.GetAxisRaw("Vertical");

        if (Input.GetKey(KeyCode.LeftShift))
        {
            currentSpeed = speedMultiplier;
        }
        else
        {
            currentSpeed = 1f;
        }

        if (forward == 0 && right == 0)
        {
            spriteMover.pauseMoving();
            return;
        }

        if (right > 0f)
        {
            spriteMover.moveRight(right * currentSpeed);
        }
        else if (right < 0f)
        {
            spriteMover.moveLeft(right * currentSpeed);
            return;
        }

        if (forward < 0f)
        {
            spriteMover.moveForward(forward * currentSpeed);
        }
        else if (forward > 0f)
        {
            spriteMover.moveBackward(forward * currentSpeed);
        }
    }
예제 #2
0
 public void pauseMoving()
 {
     right   = 0f;
     forward = 0f;
     spriteMover.pauseMoving();
 }