public void DisplayStats(Rocket rocket) { var thrust = rocket._engineRunning ? rocket._rocketInf.Thrust * rocket._thrustPercentage : 0; var resultingDrag = new Force(Angle.Zero, 0); foreach (var drag in rocket.DragForces) { resultingDrag = drag + resultingDrag; } var resultingGravity = new Force(Angle.Zero, 0); foreach (var garvity in rocket.GravityForces) { resultingGravity = garvity + resultingGravity; } var forcesWithoutGravity = resultingDrag + new Force(rocket._angle, thrust); var g = Math.Round(forcesWithoutGravity.GetAcceleration(rocket.Mass).Value / 9.80665, 1); lblStatThrustVal.Text = DecimalPoints.Add(thrust / 1000, 2) + " kN"; lblStatAccelerationVal.Text = DecimalPoints.Add(rocket.Acceleration.Value, 4) + " m/s² (" + g + "g)"; lblStatSpeedVal.Text = DecimalPoints.Add(rocket.Speed.Value, 8) + " m/s"; lblStatWeightVal.Text = DecimalPoints.Add(rocket.Mass.Value, 2) + " kg"; var fuelPercent = Math.Round(rocket._restFuelWeight / rocket._rocketInf.FuelWeight * 100); lblStatFuelWeightVal.Text = DecimalPoints.Add(rocket._restFuelWeight, 2) + " kg (" + fuelPercent + "%)"; lblStatGravityVal.Text = DecimalPoints.Add(resultingGravity.Value / 1000, 4) + " kN"; lblStatDragVal.Text = DecimalPoints.Add(resultingDrag.Value / 1000, 4) + " kN"; }
public void DisplayInformation(Rocket rocket) { var liftoffTime = rocket.LiftOffTime; var time = TimeKeeper.Now(); var diff = time - liftoffTime; lblClock.Text = "T+ " + diff.ToString(@"dd\.hh\:mm\:ss"); lblRocketName.Text = rocket._name; lblInfModelVal.Text = rocket._rocketInf.Model + " " + rocket._rocketInf.Variant; lblInfManufacturerVal.Text = rocket._rocketInf.Manufacturer; lblInfHeightVal.Text = DecimalPoints.Add(rocket._rocketInf.Height) + "m"; }
public void DisplayLocation(Rocket rocket) { var distance = float.MaxValue; var name = ""; foreach (var planet in _objects.Terrains) { var newDistance = PointCalculator.Distance(rocket.Location, planet.Location); if (newDistance < distance) { distance = newDistance - (float)planet.Diameter; name = planet.Name; } } lblLocClosestVal.Text = DecimalPoints.Add(distance, 0) + " m"; lblNameClosestVal.Text = name; lblLocAngleVal.Text = Math.Round(rocket._angle.Degree - ((rocket._angle.Degree > 180) ? 360 : 0), 1) + "°"; lblLocCoordsVal.Text = DecimalPoints.Add(rocket.Location.X, 0) + " | " + DecimalPoints.Add(rocket.Location.Y, 0); _screen.Color = CalcColor(distance); }
public void DecimalPointsSetCorrect6() { float test = 0.10231231f; Assert.AreEqual("0,10231231", DecimalPoints.Add(test)); }
public void DecimalPointsSetCorrect5() { float test = 1234567890f; Assert.AreEqual("1,2345679E+09", DecimalPoints.Add(test)); }
public void DecimalPointsSetCorrect4() { float test = 512f; Assert.AreEqual("512", DecimalPoints.Add(test)); }
public void DecimalPointsSetCorrect2() { float test = 345.23f; Assert.AreEqual("345,23", DecimalPoints.Add(test)); }