private void DoDoubleJump() { DoubleJump = true; StartLongJump(); _body.Velocity.x = XMath.AddByMod(_body.Velocity.x, GetTargetVelocityX(), Data.DoubleJumpHorAcceleration); _body.Velocity.y = Data.DoubleJumpVelocity; if (OnDoubleJump != null) { OnDoubleJump(); } }
public void Body_Moving(MovableBody body) { if (IsDead) { return; } var dt = Time.fixedDeltaTime; var velocity = body.Velocity; var vyMax = Data.GetMoveVerMax(_diver.IsActive); var ay = -GetGravity(); var targetVx = GetTargetVelocityX(); var hacc = GetHorizontalAcceleration(); velocity.x = XMath.AddByMod(velocity.x, targetVx, hacc * dt); velocity.y = GetVelocityY(dt, ay, velocity.y); if (velocity.y > vyMax) { velocity.y = vyMax; } body.Velocity = velocity; }