public override bool Jumping(ref Vector3 velocity, float delta) {
base.Jumping(ref velocity, delta);
// spring-penetration
if (velocity.y < 0 && Math.Abs(initialYPos - character.transform.position.y) < penetration) {
velocity.y += delta * currentDeceleration;
} else {
// jump
if (currentDeceleration != 0) {
currentDeceleration = 0;
velocity.y = initialVelocity;
// need to enter again, because before we were falling!
character.EnterState(States.Jumping);
} else if (velocity.y <= 0) {
// jump ended
return false;
}
}
return true;
}
}