예제 #1
0
    void HandleJump()
    {
        bool jump = false;

        if (touchControl && player.playerId == Common.PlayerId.TouchPlayer)
        {
            jump = touchControl.GetButtonDown(jumpButtonName);
        }
        else
        {
            jump = Input.GetButtonDown(inputJump) || Input.GetButtonDown("Jump");
        }


        if (jumpCount > 0)
        {
            if (jump)
            {
                float percent = jumpCount / maxJumpCount;
                jumpVelocity += Vector3.up * jumpPower * percent;
                gravity       = Vector3.zero;
                jumpCount    -= 1;
            }
        }
        controller.Move(jumpVelocity * Time.deltaTime);
        IsGrounded = controller.isGrounded;
    }