public ImpulseTrackElementModel(ImpulseTrackElement source) { IsVisible = true; Range = source.Range; IsBurning = source.IsBurning; Impulse = source.Impulse; }
private void BuildAccelerationSegments(ShellstarInfo shellstarInfo, int targetDistance, MissileAccelerationData accelData) { for (int i = 0; i < accelData.BurnDuration; i++) { int range = i < accelData.BurnDuration - 1 ? (int)(Math.Floor(accelData.ImpulseData[i + 1].Range)) : targetDistance; var impulseData = new ImpulseTrackElement { Range = range, IsBurning = true }; shellstarInfo.ImpulseTrack.Add(impulseData); } }
private void BuildInertialSegments(ShellstarInfo shellstarInfo, float driftDistance, FiringSolution firingSolution, bool isMissile) { float currentDistance = 0; bool roundUp = false; // CG shells can be fired at range 0. For this case we add a single segment. if ((int)driftDistance == 0 && firingSolution.AimAdjustment != AimAdjustment.NoShot && !isMissile) { shellstarInfo.ImpulseTrack.Add(new ImpulseTrackElement { Range = 0, IsBurning = false }); return; } // Ex 1: Drift distance = 20; RoC = 4; currentDistance = 20 is satisfies condition, 24 doesn't. // Ex 2: Drift distance = 17; RoC = 4; currentDistance = 20 is satisfies condition, 24 doesn't. while (driftDistance - currentDistance > - firingSolution.RoC) { var impulseData = new ImpulseTrackElement { Range = (int)Math.Min(currentDistance, driftDistance), IsBurning = false }; shellstarInfo.ImpulseTrack.Add(impulseData); currentDistance += roundUp ? (float)Math.Ceiling(firingSolution.RoC) : (float)Math.Floor(firingSolution.RoC); roundUp = !roundUp; } }
private void CheckImpulseData(ImpulseTrackElement element, string impulse, bool iIsBurning, int range) { element.Impulse.ToString().Should().Be(impulse); element.IsBurning.Should().Be(iIsBurning); element.Range.Should().Be(range); }