void FixedUpdate() { Debug.Log(rb.velocity); if (wantJump) { currentParav = upParav; jumpEvent?.Raise(upParav.getTimeToPeak(pVel.maxVelocity)); if (rb.velocity.y < 0) { rb.velocity += Vector2.down * rb.velocity.y; } rb.velocity += currentParav.getStartingVelocity(pVel.maxVelocity) * Vector2.up; } if (rb.velocity.y < 0 && previousVel.y >= 0) { handlePeak(); } if (rb.velocity.y != 0) { rb.gravityScale = currentParav.getGravScale(pVel.maxVelocity); } else { rb.gravityScale = 1; } wantJump = false; previousVel = rb.velocity; }
private void handlePeak() { currentParav = fallParav; rb.gravityScale = currentParav.getGravScale(pVel.maxVelocity); }