Пример #1
0
 // 跳跃方法
 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();
                 }
             }
         }
     }
 }
Пример #2
0
 // 冲刺方法
 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();
             }
         }
     }
 }