public void Step(TimeSpan elapsed) { if (TargetVelocityDegreesPerSecond == 0) { return; } if (locked && TargetVelocityDegreesPerSecond < 0.1) { // The game is actually less fussy than this, but for test purposes we require a closer approximation of 'not moving'. TargetVelocityDegreesPerSecond = 0; return; } var angleThisStep = (float)elapsed.TotalSeconds * TargetVelocityDegreesPerSecond; CurrentAngleDegrees = limits.ClampDelta(CurrentAngleDegrees, angleThisStep); }
public void AppliesLowerLimitToDeltasWhichCrossIt(float value, float delta, float limit, float expected) { var limits = new RotorLimits(limit, float.MaxValue); Assert.That(limits.ClampDelta(value, delta), Is.EqualTo(expected).Within(0.0001f)); }