public void LateUpdate() { if (display == null) { return; } if (FlightGlobals.ActiveVessel == null) { return; } FlightGlobals.SpeedDisplayModes mode = FlightGlobals.speedDisplayMode; #region all VesselTypes and Situations //VesselType.Base; //Situations.LANDED //VesselType.Debris //Situations.SPLASHED //VesselType.EVA //Situations.PRELAUNCH //VesselType.Flag //Situations.FLYING //VesselType.Lander //Situations.SUB_ORBITAL //VesselType.Plane; //Situations.ORBITING //VesselType.Probe //Situations.ESCAPING //VesselType.Relay //Situations.DOCKED //VesselType.Rover //VesselType.Ship //VesselType.SpaceObject //VesselType.Station //VesselType.Unknown #endregion switch (mode) { case FlightGlobals.SpeedDisplayModes.Surface: string titleText; Vessel.Situations situation = FlightGlobals.ActiveVessel.situation; VesselType vesselType = FlightGlobals.ActiveVessel.vesselType; double spd = FlightGlobals.ship_srfSpeed; string srfSpeedText = spd.ToString("F1") + mps; switch (vesselType) { case VesselType.Plane: case VesselType.Rover: // Boat or Submarine if (situation == Vessel.Situations.SPLASHED) { // Submarine if (FlightGlobals.ActiveVessel.altitude < BoatSubmarineBorderAlt && settings.radar) { titleText = Surf3 + Formatter.Distance_short(AGL()) + " " + (spd * kn_ms).ToString("F1") + kn; } // Boat else { titleText = Surf5 + (spd * kn_ms).ToString("F1") + knots; } } // Plane (not LANDED) else if (vesselType == VesselType.Plane && situation != Vessel.Situations.LANDED && situation != Vessel.Situations.PRELAUNCH) { bool isATM = FlightGlobals.ActiveVessel.atmDensity > 0.0; double speedIAS = FlightGlobals.ActiveVessel.indicatedAirSpeed; if (settings.radar) { double radar = FlightGlobals.ActiveVessel.radarAltitude; if (settings.mach) { if (isATM) { titleText = Surf3 + Formatter.Distance_short(radar) + " " + Localizer.Format("#SpeedUnitAnnex_mach", FlightGlobals.ActiveVessel.mach.ToString("F1")); } else { titleText = Surf5 + Formatter.Distance_long(radar); } } else { titleText = Surf3 + Formatter.Distance_short(radar) + " " + (spd * kn_ms).ToString("F1") + kn; } } else { if (settings.mach) { if (isATM) { titleText = Surf5 + Localizer.Format("#SpeedUnitAnnex_mach", FlightGlobals.ActiveVessel.mach.ToString("F1")); } else { titleText = Surface; } } else { titleText = Surf5 + (spd * kn_ms).ToString("F1") + knots; } } if (settings.ias && speedIAS > 0) { srfSpeedText += " " + speedIAS.ToString("F1"); } } // Rover (and LANDED Plane) // and rover-carrier if ksp detect them as rover else { if (settings.kmph) { titleText = Surf5 + (spd * kmph_ms).ToString("F1") + kmph; } else { titleText = Surf5 + (spd * mph_ms).ToString("F1") + mph; } } // All mistake at ksp detecting vessel type can be fixed by // some additional checking (ex. altitude for rover-carrier) // but it make unclear to user, which values is showed up. break; case VesselType.EVA: titleText = Surf3 + (settings.radar?RadarAltitudeEVA_str():"") + FinalName; break; case VesselType.Flag: titleText = Surf3 + FinalName; break; // Other: Rocket, Lander, Base etc default: if (settings.radar) { titleText = Surf5 + Formatter.Distance_long(RadarAltitude()); } else { titleText = Surface; } break; } display.textTitle.text = titleText; display.textSpeed.text = srfSpeedText; break; case FlightGlobals.SpeedDisplayModes.Orbit: if (FlightGlobals.ActiveVessel.vesselType == VesselType.EVA && settings.orbit_EVA) { display.textTitle.text = (settings.orbit_time ? "" : Orb) + FinalName; } else { double SOI_MASL = FlightGlobals.getMainBody().sphereOfInfluence - FlightGlobals.getMainBody().Radius; bool Ap_ok = FlightGlobals.getMainBody().atmosphereDepth < FlightGlobals.ship_orbit.ApA && FlightGlobals.ship_orbit.ApA < SOI_MASL; bool Pe_ok = FlightGlobals.getMainBody().atmosphereDepth < FlightGlobals.ship_orbit.PeA && FlightGlobals.ship_orbit.PeA < SOI_MASL; string Ap = Formatter.Distance_k(FlightGlobals.ship_orbit.ApA); string Pe = Formatter.Distance_k(FlightGlobals.ship_orbit.PeA); string Apsises = String.Format("<color={0}>{1}</color> <color={2}>{3}</color>", Ap_ok ? "#00ff00ff" : "#00ff009f", Ap, Pe_ok ? "#00ff00ff" : "#00ff009f", Pe); if (settings.orbit_time) { string TimeApsis; bool Apsis_ok; if (FlightGlobals.ship_orbit.timeToAp < FlightGlobals.ship_orbit.timeToPe) { Apsis_ok = Ap_ok; TimeApsis = Formatter.Time(FlightGlobals.ship_orbit.timeToAp, Ap_pre); } else { Apsis_ok = Pe_ok; TimeApsis = Formatter.Time(FlightGlobals.ship_orbit.timeToPe, Pe_pre); } display.textTitle.text = String.Format("{0} <color={1}>{2}</color>", Apsises, Apsis_ok ? "#ffffffff" : "#ffffff9f", TimeApsis); } else { display.textTitle.text = Orb + Apsises; } } display.textSpeed.text = FlightGlobals.ship_obtSpeed.ToString("F1") + mps; break; case FlightGlobals.SpeedDisplayModes.Target: #region all Target // 1.5.1 // ITargetable -> CelestialBody; // FlightCoMTracker; // ModuleDockingNode; // PositionTarget; // Vessel; #endregion ITargetable obj = FlightGlobals.fetch.VesselTarget; if (obj == null) { display.textTitle.text = NoTrg; return; } string distanceToTarget = ""; if (settings.targetDistance) { distanceToTarget = CalcTargetDistance(obj); } if (Target != obj) { TargetName = CutName(Trg + distanceToTarget, GetTargetName(obj)); Target = obj; } display.textTitle.text = Trg + distanceToTarget + TargetName; if (FlightGlobals.ship_tgtSpeed < 0.195) { display.textSpeed.text = FlightGlobals.ship_tgtSpeed.ToString("F2") + mps; } else { display.textSpeed.text = FlightGlobals.ship_tgtSpeed.ToString("F1") + mps; } break; } // need to be there, for every tick. Doesn't work in the Start() or onSetSpeedMode() display.textTitle.alignment = TMPro.TextAlignmentOptions.MidlineLeft; }
public void LateUpdate() { if (display == null) { return; } if (FlightGlobals.ActiveVessel == null) { return; } if (settings == null) { settings = HighLogic.CurrentGame.Parameters.CustomParams <SpeedUnitAnnexSettings>(); } //Log("{0:F1}, {1:F1}={2:F1}, {3:F1}, {4:F1}={5:F1}", // FlightGlobals.ActiveVessel.heightFromTerrain == FlightGlobals.ship_altitude - FlightGlobals.ActiveVessel.terrainAltitude, // FlightGlobals.ActiveVessel.heightFromTerrain, FlightGlobals.ship_altitude - FlightGlobals.ActiveVessel.terrainAltitude, // FlightGlobals.ship_altitude == FlightGlobals.ActiveVessel.altitude, FlightGlobals.ship_altitude, FlightGlobals.ActiveVessel.altitude); FlightGlobals.SpeedDisplayModes mode = FlightGlobals.speedDisplayMode; #region all VesselTypes and Situations //VesselType.Base; //Situations.LANDED //VesselType.Debris //Situations.SPLASHED //VesselType.EVA //Situations.PRELAUNCH //VesselType.Flag //Situations.FLYING //VesselType.Lander //Situations.SUB_ORBITAL //VesselType.Plane; //Situations.ORBITING //VesselType.Probe //Situations.ESCAPING //VesselType.Relay //Situations.DOCKED //VesselType.Rover //VesselType.Ship //VesselType.SpaceObject //VesselType.Station //VesselType.Unknown #endregion switch (mode) { case FlightGlobals.SpeedDisplayModes.Surface: string titleText; Vessel.Situations situation = FlightGlobals.ActiveVessel.situation; VesselType vesselType = FlightGlobals.ActiveVessel.vesselType; double spd = FlightGlobals.ship_srfSpeed; string srfSpeedText = spd.ToString("F1") + mps_s; switch (vesselType) { case VesselType.Plane: case VesselType.Rover: // Boat or Submarine if (situation == Vessel.Situations.SPLASHED) { // Submarine if (FlightGlobals.ActiveVessel.altitude < BoatSubmarineBorderAlt && settings.radar) { titleText = Surf3 + Formatter.Distance_short(AGL()) + " " + (spd * knTOms).ToString("F1") + kn_s; } // Boat else { titleText = Surf5 + (spd * knTOms).ToString("F1") + knots_s; } } // Plane (not LANDED) else if (vesselType == VesselType.Plane && situation != Vessel.Situations.LANDED && situation != Vessel.Situations.PRELAUNCH) { bool isATM = FlightGlobals.ActiveVessel.atmDensity > 0.0; //double speedIAS = FlightGlobals.ActiveVessel.indicatedAirSpeed; if (settings.radar) { double radar = FlightGlobals.ActiveVessel.radarAltitude; if (settings.aircraft == MachNum) { if (isATM) { titleText = Surf3 + Formatter.Distance_short(radar) + " " + Localizer.Format("#SpeedUnitAnnex_mach", FlightGlobals.ActiveVessel.mach.ToString("F1")); } else { titleText = Surf5 + Formatter.Distance_long(radar); } } else if (settings.aircraft == knots) { titleText = Surf3 + Formatter.Distance_short(radar) + " " + (spd * knTOms).ToString("F1") + kn_s; } else if (settings.aircraft == kmph) { titleText = Surf3 + Formatter.Distance_short(radar) + " " + (spd * kmphTOms).ToString("F1") + kmph_s; } else // settings.aircraft == mph { titleText = Surf3 + Formatter.Distance_short(radar) + " " + (spd * mphTOms).ToString("F1") + mph_s; } } else { if (settings.aircraft == MachNum) { if (isATM) { titleText = Surf5 + Localizer.Format("#SpeedUnitAnnex_mach", FlightGlobals.ActiveVessel.mach.ToString("F1")); } else { titleText = Surf_full; } } else if (settings.aircraft == knots) { titleText = Surf5 + (spd * knTOms).ToString("F1") + knots_s; } else if (settings.aircraft == kmph) { titleText = Surf5 + (spd * kmphTOms).ToString("F1") + kmph_s; } else // settings.aircraft == mph { titleText = Surf5 + (spd * mphTOms).ToString("F1") + mph_s; } } if (settings.ias) { double speedIAS = 0; if (isLoadedFAR) { speedIAS = FAR_ActiveVesselIAS(); } else { speedIAS = FlightGlobals.ActiveVessel.indicatedAirSpeed; } if (speedIAS > 0) { srfSpeedText += " " + speedIAS.ToString("F1"); } } } // Rover (and LANDED Plane) // and rover-carrier if ksp detect them as rover else { if (settings.rover == kmph) { titleText = Surf5 + (spd * kmphTOms).ToString("F1") + kmph_s; } else // settings.rover == mph { titleText = Surf5 + (spd * mphTOms).ToString("F1") + mph_s; } } // All mistake at ksp detecting vessel type can be fixed by // some additional checking (ex. altitude for rover-carrier) // but it make unclear to user, which values is showed up. break; case VesselType.EVA: titleText = Surf3 + (settings.radar ? RadarAltitudeEVA_str() : "") + FinalName; break; case VesselType.Flag: titleText = Surf3 + FinalName; break; // Other: Rocket, Lander, Base etc default: if (settings.radar) { titleText = Surf5 + Formatter.Distance_long(RadarAltitude()); } else { titleText = Surf_full; } break; } display.textTitle.text = titleText; display.textSpeed.text = srfSpeedText; break; case FlightGlobals.SpeedDisplayModes.Orbit: if (FlightGlobals.ActiveVessel.vesselType == VesselType.EVA && settings2.orbit_EVA) { display.textTitle.text = (settings2.orbit_ApPe && settings2.orbit_time ? "" : Orb) + FinalName; } else if (settings2.orbit_ApPe || settings2.orbit_time) { double SOI_MASL = FlightGlobals.getMainBody().sphereOfInfluence - FlightGlobals.getMainBody().Radius; bool Ap_ok = FlightGlobals.getMainBody().atmosphereDepth < FlightGlobals.ship_orbit.ApA && FlightGlobals.ship_orbit.ApA < SOI_MASL; bool Pe_ok = FlightGlobals.getMainBody().atmosphereDepth < FlightGlobals.ship_orbit.PeA && FlightGlobals.ship_orbit.PeA < SOI_MASL; if (settings2.orbit_ApPe) { string Ap = Formatter.Distance_k(FlightGlobals.ship_orbit.ApA); string Pe = Formatter.Distance_k(FlightGlobals.ship_orbit.PeA); string Apsises = String.Format("<color={0}>{1}</color> <color={2}>{3}</color>", Ap_ok ? "#00ff00ff" : "#00ff009f", Ap, Pe_ok ? "#00ff00ff" : "#00ff009f", Pe); string TimeApsis; bool Apsis_ok; if (settings2.orbit_time) { if (FlightGlobals.ship_orbit.timeToAp < FlightGlobals.ship_orbit.timeToPe) { Apsis_ok = Ap_ok; TimeApsis = Formatter.Time(FlightGlobals.ship_orbit.timeToAp, A_prefix); } else { Apsis_ok = Pe_ok; TimeApsis = Formatter.Time(FlightGlobals.ship_orbit.timeToPe, P_prefix); } display.textTitle.text = String.Format("{0} <color={1}>{2}</color>", Apsises, Apsis_ok ? "#ffffffff" : "#ffffff9f", TimeApsis); } else { display.textTitle.text = Orb + Apsises; } } else if (settings2.orbit_time) { string TimeApsis; bool Apsis_ok; if (FlightGlobals.ship_orbit.timeToAp < FlightGlobals.ship_orbit.timeToPe) { Apsis_ok = Ap_ok; TimeApsis = Formatter.TimeLong(FlightGlobals.ship_orbit.timeToAp, ApT_prefix); } else { Apsis_ok = Pe_ok; TimeApsis = Formatter.TimeLong(FlightGlobals.ship_orbit.timeToPe, PeT_prefix); } display.textTitle.text = String.Format("<color={0}>{1}</color>", Apsis_ok ? "#00ff00ff" : "#00ff009f", TimeApsis); } } else { display.textTitle.text = Orb_full; } display.textSpeed.text = FlightGlobals.ship_obtSpeed.ToString("F1") + mps_s; break; case FlightGlobals.SpeedDisplayModes.Target: #region all Target // 1.6.0 // ITargetable: // * CelestialBody // * FlightCoMTracker // * ModuleDockingNode // * PositionTarget: // * DirectionTarget // * Vessel #endregion ITargetable obj = FlightGlobals.fetch.VesselTarget; if (obj == null) { display.textTitle.text = NoTrg; return; } bool isMDN = obj is ModuleDockingNode; if (settings2.targetAngles && isMDN) { Vector3 angles = GetOrientationDeviation(obj); if (settings2.targetInteger) { display.textTitle.text = Trg + Formatter.Angle(angles.x, true, 5) + Formatter.Angle(angles.y, true, 5) + Formatter.Angle(angles.z, true, 5); } else { display.textTitle.text = Formatter.Angle(angles.x) + Formatter.Angle(angles.y) + Formatter.Angle(angles.z); } } else { string TargetAngle = ""; string distanceToTarget = ""; if (settings2.targetAngle && isMDN) { Vector3 angles = GetOrientationDeviation(obj); if (settings2.targetInteger) { TargetAngle = Formatter.Angle(angles.z, true, 5); } else { TargetAngle = Formatter.Angle(angles.z); } } if (settings2.targetDistance) { distanceToTarget = CalcTargetDistance(obj); } bool isAngleAndDistance = settings2.targetDistance && settings2.targetAngle && isMDN; if (settings2.targetName && !isAngleAndDistance) { if (Target != obj) { TargetName = CutName(Trg + distanceToTarget + TargetAngle, GetTargetName(obj)); Target = obj; } display.textTitle.text = Trg + distanceToTarget + TargetName + TargetAngle; } else { display.textTitle.text = Trg + distanceToTarget + " " + TargetAngle; // 2 spaces } } if (FlightGlobals.ship_tgtSpeed < 0.195) { display.textSpeed.text = FlightGlobals.ship_tgtSpeed.ToString("F2") + mps_s; } else { display.textSpeed.text = FlightGlobals.ship_tgtSpeed.ToString("F1") + mps_s; } break; } // need to be there, for every tick. Doesn't work in the Start() or onSetSpeedMode() display.textTitle.alignment = TMPro.TextAlignmentOptions.MidlineLeft; }
public void LateUpdate() { if (display != null) { FlightGlobals.SpeedDisplayModes mode = FlightGlobals.speedDisplayMode; switch (mode) { case FlightGlobals.SpeedDisplayModes.Surface: Vessel.Situations situation = FlightGlobals.ActiveVessel.situation; VesselType vesselType = FlightGlobals.ActiveVessel.vesselType; double spd = FlightGlobals.ship_srfSpeed; string speedText = spd.ToString("F1") + mps; #region all VesselTypes and Situations //VesselType.Base; //Situations.LANDED //VesselType.Debris //Situations.SPLASHED //VesselType.EVA //Situations.PRELAUNCH //VesselType.Flag //Situations.FLYING //VesselType.Lander //Situations.SUB_ORBITAL //VesselType.Plane; //Situations.ORBITING //VesselType.Probe //Situations.ESCAPING //VesselType.Relay //Situations.DOCKED //VesselType.Rover //VesselType.Ship //VesselType.SpaceObject //VesselType.Station //VesselType.Unknown #endregion switch (vesselType) { case VesselType.Plane: case VesselType.Rover: // Boat or Submarine if (situation == Vessel.Situations.SPLASHED) { if (FlightGlobals.ActiveVessel.altitude < -20 && settings.radar) // Submarine { titleText = Surf3 + Formatter.Distance_short(FlightGlobals.ActiveVessel.altitude - FlightGlobals.ActiveVessel.terrainAltitude) + " " + (spd * kn_ms).ToString("F1") + kn; } else // Boat { titleText = Surf5 + (spd * kn_ms).ToString("F1") + knots; } } // Plane (not LANDED) else if (vesselType == VesselType.Plane && situation != Vessel.Situations.LANDED && situation != Vessel.Situations.PRELAUNCH) { bool isATM = FlightGlobals.ActiveVessel.atmDensity > 0.0; double speedIAS = FlightGlobals.ActiveVessel.indicatedAirSpeed; if (settings.radar) { if (settings.mach) { if (isATM) { titleText = Surf3 + Formatter.Distance_short(FlightGlobals.ActiveVessel.radarAltitude) + " " + Localizer.Format("#SpeedUnitAnnex_mach", FlightGlobals.ActiveVessel.mach.ToString("F1")); } else { titleText = Surf5 + Formatter.Distance_long(FlightGlobals.ActiveVessel.radarAltitude); } } else { titleText = Surf3 + Formatter.Distance_short(FlightGlobals.ActiveVessel.radarAltitude) + " " + (spd * kn_ms).ToString("F1") + kn; } } else { if (settings.mach) { if (isATM) { titleText = Surf5 + Localizer.Format("#SpeedUnitAnnex_mach", FlightGlobals.ActiveVessel.mach.ToString("F1")); } else { titleText = Surface; } } else { titleText = Surf5 + (spd * kn_ms).ToString("F1") + knots; } } if (settings.ias && speedIAS > 0) { speedText += " " + speedIAS.ToString("F1"); } } // Rover (and LANDED Plane) // and rover-carrier if ksp detect them as rover // All mistake at ksp detecting vessel type can be fixed by some additional checking (ex. altitude for rover-carrier) // but it make unclear to user, which values is showed up. else //if FlightGlobals.ActiveVessel.radarAltitude < 100) { if (settings.kmph) { titleText = Surf5 + (spd * kmph_ms).ToString("F1") + kmph; } else { titleText = Surf5 + (spd * mph_ms).ToString("F1") + mph; } } break; case VesselType.EVA: if (settings.radar) { double alt = FlightGlobals.ActiveVessel.radarAltitude; if (situation == Vessel.Situations.SPLASHED) { alt += 0.21; } else { alt -= 0.27; } titleText = Surf3 + Formatter.Distance_short(alt) + " " + FlightGlobals.ActiveVessel.GetDisplayName(); } else { titleText = Surf3 + FlightGlobals.ActiveVessel.GetDisplayName(); } if (titleText.Length > 17) { titleText = titleText.Substring(0, 16) + "..."; } break; case VesselType.Flag: titleText = Surf3 + FlightGlobals.ActiveVessel.GetDisplayName(); if (titleText.Length > 17) { titleText = titleText.Substring(0, 16) + "..."; } break; // Other: Rocket, Lander, Base etc default: if (settings.radar) { titleText = Surf5 + Formatter.Distance_long(FlightGlobals.ActiveVessel.radarAltitude); } else { titleText = Surface; } break; } display.textTitle.text = titleText; display.textSpeed.text = speedText; break; case FlightGlobals.SpeedDisplayModes.Orbit: if (FlightGlobals.ActiveVessel.vesselType == VesselType.EVA && settings.orbit_EVA) { if (settings.orbit_time) { titleText = FlightGlobals.ActiveVessel.GetDisplayName(); } else { titleText = Orb + FlightGlobals.ActiveVessel.GetDisplayName(); } if (titleText.Length > 17) { titleText = titleText.Substring(0, 16) + "..."; } display.textTitle.text = titleText; } else { double SOI_MASL = FlightGlobals.getMainBody().sphereOfInfluence - FlightGlobals.getMainBody().Radius; bool Ap_ok = FlightGlobals.getMainBody().atmosphereDepth < FlightGlobals.ship_orbit.ApA && FlightGlobals.ship_orbit.ApA < SOI_MASL; bool Pe_ok = FlightGlobals.getMainBody().atmosphereDepth < FlightGlobals.ship_orbit.PeA && FlightGlobals.ship_orbit.PeA < SOI_MASL; string Ap = Formatter.Distance_k(FlightGlobals.ship_orbit.ApA); string Pe = Formatter.Distance_k(FlightGlobals.ship_orbit.PeA); string Apsises = (Ap_ok ? "<color=#00ff00ff>" : "<color=#00ff009f>") + Ap + (Pe_ok ? " <color=#00ff00ff>" : " <color=#00ff009f>") + Pe; if (settings.orbit_time) { //double tTr = FlightGlobals.ship_orbit.timeToTransition1; string TimeApsis; bool Apsis_ok; if (FlightGlobals.ship_orbit.timeToAp < FlightGlobals.ship_orbit.timeToPe) { Apsis_ok = Ap_ok; TimeApsis = Formatter.Time(FlightGlobals.ship_orbit.timeToAp, Ap_pre); } else { Apsis_ok = Pe_ok; TimeApsis = Formatter.Time(FlightGlobals.ship_orbit.timeToPe, Pe_pre); } display.textTitle.text = Apsises + (Apsis_ok ? " <color=#ffffffff>" : " <color=#ffffff9f>") + TimeApsis; } else { display.textTitle.text = Orb + Apsises; } } display.textSpeed.text = FlightGlobals.ship_obtSpeed.ToString("F1") + mps; break; case FlightGlobals.SpeedDisplayModes.Target: ITargetable obj = FlightGlobals.fetch.VesselTarget; #region all Target // ITargetable -> CelestialBody; // FlightCoMTracker; // ModuleDockingNode; // PositionTarget; // Vessel; #endregion string name; if (obj is ModuleDockingNode) { name = obj.GetVessel().GetDisplayName(); } else { name = obj.GetDisplayName(); } if (name.Length > 1 && name.Substring(name.Length - 2, 1) == "^") { name = name.Substring(0, name.Length - 2); } if (settings.targetDistance) { // from Docking Port Alignment Indicator Transform selfTransform = FlightGlobals.ActiveVessel.ReferenceTransform; Transform targetTransform = FlightGlobals.fetch.VesselTarget.GetTransform(); Vector3 targetToOwnship = selfTransform.position - targetTransform.position; float distanceToTarget = targetToOwnship.magnitude; titleText = Trg + Formatter.Distance_short(distanceToTarget) + " " + name; } else { titleText = Trg + name; } if (titleText.Length <= 17) { display.textTitle.text = titleText; } else { display.textTitle.text = titleText.Substring(0, 16) + "..."; } if (FlightGlobals.ship_tgtSpeed < 0.195) { display.textSpeed.text = FlightGlobals.ship_tgtSpeed.ToString("F2") + mps; } else { display.textSpeed.text = FlightGlobals.ship_tgtSpeed.ToString("F1") + mps; } break; } // need to be there, for every tick. Doesn't work in the Start() or onSetSpeedMode() display.textTitle.alignment = TMPro.TextAlignmentOptions.MidlineLeft; } }