Example #1
0
 public void OnJumpInput()
 {
     if (wallGrab)
     {
         playerAnimator.playerAnimator.SetTrigger("Jumped");
         if (wallDirX == directionalInput.x)
         {
             velocity.x = velocity.x * -wallJumpClimb.x;
             velocity.y = wallJumpClimb.y;
         }
     }
     if (controller.collisions.below)
     {
         velocity.y = maxJumpVelocity;
         doubleJump = true;
         playerAnimator.JumpAnimation();
     }
     // doubleJump bool and else if statement below allow a second jump at desired % power while airborne
     else if (doubleJump)
     {
         doubleJump = false;
         velocity.y = maxJumpVelocity * doubleJumpMultiplier;
         playerAnimator.DoubleJumpAnimation();
     }
     // TODO: Why is this needed here?  Can't jump without it, even though it's in the update method already...
     controller.Move(velocity * Time.deltaTime, directionalInput);
 }