// 跳跃方法 void Jump() { if (!OneWayPlatformJump()) { if (Input.GetKeyDown(KeyCode.U) && !playerStateManager.isAttack && !slidingWall) { if (isGrounded || isClimbingLadder) { EndClimbLadder(); rigi.velocity = new Vector2(rigi.velocity.x, jumpSpeed); canDoubleJump = true; playerStateManager.Jump(); //this.rigi.AddForce(new Vector2(0, jumpSpeed)); } else { if (canDoubleJump) { rigi.velocity = new Vector2(rigi.velocity.x, doubleJumpSpeed); canDoubleJump = false; playerStateManager.Jump(); } } } } }
// 冲刺方法 void Jump() { if (Input.GetKeyDown(KeyCode.U) && !playerStateManager.isAttack) { if (isGrounded) { rigi.velocity = new Vector2(rigi.velocity.x, jumpSpeed); canDoubleJump = true; playerStateManager.Jump(); //this.rigi.AddForce(new Vector2(0, jumpSpeed)); } else { if (canDoubleJump) { rigi.velocity = new Vector2(rigi.velocity.x, doubleJumpSpeed); canDoubleJump = false; playerStateManager.Jump(); } } } }