public void FiringSolutionCalculationTest() { var solutionA = _calculator.CalculateSolution(4, 20, 2, 8); solutionA.AimAdjustment.Should().Be(AimAdjustment.Shift2Window); solutionA.CrossingVector.Should().Be(20); solutionA.MuzzleVelocity.Should().Be(16); solutionA.ShotGeometryRow.Should().Be(2); solutionA.ShotGeometryColumn.Should().Be(2); solutionA.CrossingVectorAdjustment.Should().Be(0.5f); solutionA.MuzzleVelocityAdjustment.Should().Be(0.5f); solutionA.ModifiedCrossingVector.Should().Be(10); solutionA.ModifiedMuzzleVelocity.Should().Be(8); solutionA.RoCTurn.Should().Be(18); solutionA.RoC.Should().Be(2.0f); var solutionB = _calculator.CalculateSolution(4, 20, 3, 8); solutionB.AimAdjustment.Should().Be(AimAdjustment.Shift1Window); solutionB.CrossingVector.Should().Be(20); solutionB.MuzzleVelocity.Should().Be(24); solutionB.ShotGeometryRow.Should().Be(1); solutionB.ShotGeometryColumn.Should().Be(2); solutionB.CrossingVectorAdjustment.Should().Be(0.5f); solutionB.MuzzleVelocityAdjustment.Should().Be(0.9f); solutionB.ModifiedCrossingVector.Should().Be(10); solutionB.ModifiedMuzzleVelocity.Should().Be(22); solutionB.RoCTurn.Should().Be(32); solutionB.RoC.Should().Be(4.0f); var solutionC = _calculator.CalculateSolution(2, 20, 2, 8); solutionC.AimAdjustment.Should().Be(AimAdjustment.NoShot); solutionC.CrossingVector.Should().Be(20); solutionC.MuzzleVelocity.Should().Be(16); solutionC.ShotGeometryRow.Should().Be(3); solutionC.ShotGeometryColumn.Should().Be(4); solutionC.CrossingVectorAdjustment.Should().Be(-0.5f); solutionC.MuzzleVelocityAdjustment.Should().Be(0f); solutionC.ModifiedCrossingVector.Should().Be(-10); solutionC.ModifiedMuzzleVelocity.Should().Be(0); solutionC.RoCTurn.Should().Be(-10); solutionC.RoC.Should().Be(-1f); var solutionD = _calculator.CalculateSolution(6, 12, 2, 8); solutionD.AimAdjustment.Should().Be(AimAdjustment.BearingWindow); solutionD.CrossingVector.Should().Be(12); solutionD.MuzzleVelocity.Should().Be(16); solutionD.ShotGeometryRow.Should().Be(0); solutionD.ShotGeometryColumn.Should().Be(0); solutionD.CrossingVectorAdjustment.Should().Be(1f); solutionD.MuzzleVelocityAdjustment.Should().Be(1f); solutionD.ModifiedCrossingVector.Should().Be(12); solutionD.ModifiedMuzzleVelocity.Should().Be(16); solutionD.RoCTurn.Should().Be(28); solutionD.RoC.Should().Be(3.5f); }
public void CoilgunTest1() { // Integer RoC. Distance is divisible by RoC. var solution = _firingSolutionCalc.CalculateSolution(4, 20, 3, CoilgunAcceleration); solution.AimAdjustment.Should().Be(AimAdjustment.Shift1Window); solution.RoC.Should().Be(4.0f); var shellstarInfo = _shellstarBuilder.BuildShellstarInfo(20, new TurnData(2, 3), solution, null); shellstarInfo.RoC.Should().Be(4f); shellstarInfo.Dmg50.Should().Be(12); shellstarInfo.Dmg100.Should().Be(25); shellstarInfo.Dmg200.Should().Be(50); shellstarInfo.ImpulseTrack.Count.Should().Be(6); shellstarInfo.ImpulseTrack[0].Impulse.Equals("2.3"); shellstarInfo.ImpulseTrack[0].IsBurning.Should().BeFalse(); shellstarInfo.ImpulseTrack[0].Range.Should().Be(20); shellstarInfo.ImpulseTrack[1].Impulse.Equals("2.4"); shellstarInfo.ImpulseTrack[1].IsBurning.Should().BeFalse(); shellstarInfo.ImpulseTrack[1].Range.Should().Be(16); shellstarInfo.ImpulseTrack[2].Impulse.Equals("2.5"); shellstarInfo.ImpulseTrack[2].IsBurning.Should().BeFalse(); shellstarInfo.ImpulseTrack[2].Range.Should().Be(12); shellstarInfo.ImpulseTrack[3].Impulse.Equals("2.6"); shellstarInfo.ImpulseTrack[3].IsBurning.Should().BeFalse(); shellstarInfo.ImpulseTrack[3].Range.Should().Be(8); shellstarInfo.ImpulseTrack[4].Impulse.Equals("2.7"); shellstarInfo.ImpulseTrack[4].IsBurning.Should().BeFalse(); shellstarInfo.ImpulseTrack[4].Range.Should().Be(4); shellstarInfo.ImpulseTrack[5].Impulse.Equals("2.8"); shellstarInfo.ImpulseTrack[5].IsBurning.Should().BeFalse(); shellstarInfo.ImpulseTrack[5].Range.Should().Be(0); }
public void CalculateFiringSolution() { var firingSolution = _firingSolutionCalculator.CalculateSolution( CourseOffset, CrossingVector.Magnitude, WeaponSelection.MuzzleVelocityMultiplyer, WeaponSelection.Acceleration); MissileAccelerationData missileAccelerationData = null; if (WeaponSelection.IsMissile && firingSolution.AimAdjustment != AimAdjustment.NoShot) { missileAccelerationData = _firingSolutionCalculator.CalculateMissileAcceleration( TargetDistance.Magnitude, WeaponSelection.MuzzleVelocityMultiplyer, WeaponSelection.Acceleration, firingSolution.AimAdjustment, firingSolution.RoC); } IShellstarModel shellstar = BuildShellstar(firingSolution, missileAccelerationData); UpdateFiringSolution(firingSolution, missileAccelerationData, shellstar); }