Beispiel #1
0
 public void ProcessInputs(bool grounded, bool jumpButtonPressed, JumpController jumpController)
 {
     if (jumpButtonPressed &&
         jumpController.wasJumpButtonReleasedInBetween)
     {
         jumpController.anim.SetBool("Jump", true);
         jumpController.jumpAudio.Play();
         jumpController.AddJumpForce();
         jumpController.currentJumpState = jumpController.airbornAddingForceState;
         jumpController.wasJumpButtonReleasedInBetween = false;
     }
     else
     {
         jumpController.anim.SetBool("Jump", false);
     }
 }
Beispiel #2
0
 public void ProcessInputs(bool grounded, bool jumpButtonPressed, JumpController jumpController)
 {
     // The player can quickly get grounded if the ceiling is low for example
     if (grounded && jumpController.rigidbody.velocity.y <= 0)
     {
         SetJumpControllerState(jumpController, jumpController.groundedState);
     }
     else if (jumpButtonPressed && forceAddedCount < jumpController.maxForceAddTimes)
     {
         forceAddedCount++;
         jumpController.AddJumpForce();
     }
     else
     {
         SetJumpControllerState(jumpController, jumpController.airbornNotAddingForceState);
     }
 }