Exemplo n.º 1
0
 private void JumpMovement()
 {
     if (IsGrounded())
     {
         if (inputs.SpacePressed())
         {
             rb.AddForce(transform.up * jumpPower, ForceMode.VelocityChange);
         }
     }
 }
Exemplo n.º 2
0
 private void OnCollisionStay(Collision collision)
 {
     if (collision.transform.CompareTag("RunningWall"))
     {
         if (inputs.shiftKey && isWallGrabbing == true)
         {
             if (inputs.SpacePressed())
             {
                 StopWallRunning();
                 rb.AddForce(ContactNormal() * wallJumpPower + new Vector3(0, 4, 0), ForceMode.VelocityChange);
             }
             else
             {
                 contactNormal = collision.contacts[0].normal;
                 rb.MovePosition(rb.position - ContactNormal() * wallStickPower * Time.deltaTime);
                 particleToTarget.UpdateParticleTargetLocation(collision.contacts[0].point);
             }
         }
         else
         {
             StopWallRunning();
         }
     }
 }