Ejemplo n.º 1
0
    public void GetMoveInputAndMove()
    {
        Vector2 input    = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
        Vector2 inputDir = input.normalized;
        bool    running  = Input.GetKey(KeyCode.LeftShift);

        if (running && (inputDir.x != 0 || inputDir.y != 0))
        {
            running = true;
        }

        MovePlayer(inputDir, running);

        float speedPercent = ((running) ? currentSpeed / runSpeed : currentSpeed / walkSpeed * .5f);

        playerAnimator.PlayerMoverAnimation(speedPercent, speedSmoothTime, walkSpeed / defaultWalkSpeed);
    }