I'm trying to make my character be able to jump whenever he is grounded OR if he's airborne to only be able to jump when he has extra jumps and x amount of time has passed. Currenty I have this:´
void Jump()
{
jumpTime -= Time.fixedDeltaTime;
if ((jumpRemember > 0) && ((groundRemember > 0) || ((jumps>0) && (jumpTime <= 0))))
{
jumpRemember = 0;
groundRemember = 0;
rb.velocity = new Vector2(rb.velocity.x, jumpForce);
jumps--;
jumpTime = timeSinceLastJump;
}
}
(the jump remember and ground remember are checks to see if i pressed the jump button or was grounded in the last 0.1 seconds)
but when he is grounded and collides with a roof and get sent back to ground he cant jump after the time has passed anyways, even though I used the ''OR'' operator.