private void Awake() { Debug.Log("Radar sender awoken for object " + gameObject.name); lr = gameObject.GetComponentInChildren <LockingRadar>(); if (lr == null) { Debug.LogError($"LockingRadar on networkUID {networkUID} is null"); return; } lr.radar = gameObject.GetComponentInChildren <Radar>(); if (lr.radar == null) { Debug.LogError($"Radar null on netUID {networkUID}"); } else { lr.radar.OnDetectedActor += RadarDetectedActor; // Debug.Log($"Radar sender successfully attached to object {gameObject.name}."); } controller = gameObject.GetComponentInChildren <TacticalSituationController>(); if (controller != null) { Debug.Log($"{networkUID} is a player F45."); controller.OnAutoRadarLocked += F45LockedUpdate; controller.OnAutoRadarUnlocked += F45UnlockedUpdate; } lastRadarMessage = new Message_RadarUpdate(true, 0, networkUID); lastLockingMessage = new Message_LockingRadarUpdate(0, false, networkUID); }
public static Actor getRadarLockTarget(GameObject vehicle, Actor player) { Actor detectedActor = new Actor(); if (player.name == "VTOL4") { return(null); } try { LockingRadar radar = vehicle.GetComponentInChildren <LockingRadar>(); if (radar != null) { if (radar.IsLocked()) { return(radar.currentLock.actor); } else { return(null); } } else { return(null); } } catch (Exception) { support.WriteLog("Got error while getting radar lock data"); return(null); } }
private void Awake() { lockingRadar = gameObject.GetComponentInChildren <LockingRadar>(); if (lockingRadar == null) { Debug.Log($"Locking radar on networkUID {networkUID} is null."); return; } lockingRadar.radar = gameObject.GetComponentInChildren <Radar>(); if (lockingRadar.radar == null) { Debug.Log($"Radar was null on network uID {networkUID}"); } // lockingRadar.debugRadar = true; lastRadarMessage = new Message_RadarUpdate(false, 0, networkUID); Networker.RadarUpdate += RadarUpdate; Networker.LockingRadarUpdate += LockingRadarUpdate; }
private void FixedUpdate() { tick += Time.fixedDeltaTime; if (lr == null) { Debug.LogError($"LockingRadar is null for object {gameObject.name} with an uid of {networkUID}."); lr = gameObject.GetComponentInChildren <LockingRadar>(); } if (lr == null) { return; } if (lr.radar == null) { //Debug.LogError("This radar.radar shouldn't be null. If this error pops up a second time then be worried. Null on " + gameObject.name); lr.radar = gameObject.GetComponentInChildren <Radar>(); } if (lr.radar != null) { if (lr.radar.radarEnabled != lastOn || lr.radar.sweepFov != lastFov) { // Debug.Log("radar.radar is not equal to last on"); lastRadarMessage.UID = networkUID; // Debug.Log("last uid"); lastRadarMessage.on = lr.radar.radarEnabled; // Debug.Log("on enabled"); lastRadarMessage.fov = lr.radar.sweepFov; Debug.Log("Sending sweepFOV"); if (Networker.isHost) { NetworkSenderThread.Instance.SendPacketAsHostToAllClients(lastRadarMessage, Steamworks.EP2PSend.k_EP2PSendReliable); } else { NetworkSenderThread.Instance.SendPacketToSpecificPlayer(Networker.hostID, lastRadarMessage, Steamworks.EP2PSend.k_EP2PSendReliable); } Debug.Log("last 2"); lastOn = lr.radar.radarEnabled; Debug.Log("last one"); lastFov = lr.radar.sweepFov; } } if (controller == null) { // if (lr.currentLock != lastRadarLockData) { stateChanged = true; } if (lr.currentLock != null) { if (lr.IsLocked() != lastLockingMessage.isLocked) { stateChanged = true; } if (lr.currentLock.actor != lastRadarLockData.actor) { lastRadarLockData.actor = lr.currentLock.actor; stateChanged = true; } if (lr.currentLock.locked != lastRadarLockData.locked) { lastRadarLockData.locked = lr.currentLock.locked; stateChanged = true; } } else if (!lastWasNull) { stateChanged = true; } // if (lr.IsLocked() != lastLockingMessage.isLocked || lr.currentLock != null && (lr.currentLock != lastRadarLockData || lr.currentLock.actor != lastRadarLockData.actor)) if (stateChanged) { Debug.Log("is lock not equal to last message is locked for network uID " + networkUID); if (lr.currentLock == null) { Debug.Log("lr lock data null"); lastWasNull = true; lastLockingMessage.actorUID = 0; lastLockingMessage.isLocked = false; lastLockingMessage.senderUID = networkUID; Debug.Log($"Sending a locking radar message from uID {networkUID}"); if (Networker.isHost) { NetworkSenderThread.Instance.SendPacketAsHostToAllClients(lastLockingMessage, EP2PSend.k_EP2PSendReliable); } else { NetworkSenderThread.Instance.SendPacketToSpecificPlayer(Networker.hostID, lastLockingMessage, EP2PSend.k_EP2PSendReliable); } } else { // Debug.Log("Else going into dictionary"); try { // ulong key = (from p in VTOLVR_Multiplayer.AIDictionaries.allActors where p.Value == lr.currentLock.actor select p.Key).FirstOrDefault(); if (VTOLVR_Multiplayer.AIDictionaries.reverseAllActors.TryGetValue(lastRadarLockData.actor, out lastID)) { lastWasNull = false; Debug.Log(lastRadarLockData.actor.name + " radar data found its lock " + lr.currentLock.actor.name + " at id " + lastID + " with its own uID being " + networkUID); lastLockingMessage.actorUID = lastID; lastLockingMessage.isLocked = true; lastLockingMessage.senderUID = networkUID; if (Networker.isHost) { NetworkSenderThread.Instance.SendPacketAsHostToAllClients(lastLockingMessage, EP2PSend.k_EP2PSendUnreliable); NetworkSenderThread.Instance.SendPacketAsHostToAllClients(lastLockingMessage, EP2PSend.k_EP2PSendReliable); } else { NetworkSenderThread.Instance.SendPacketAsHostToAllClients(lastLockingMessage, EP2PSend.k_EP2PSendUnreliable); NetworkSenderThread.Instance.SendPacketToSpecificPlayer(Networker.hostID, lastLockingMessage, EP2PSend.k_EP2PSendReliable); } } else { Debug.LogError("Could not resolve lock at actor " + lastRadarLockData.actor.name); } } catch (Exception ex) { Debug.LogError("Couldn't lock target " + lr.currentLock.actor + $" exception {ex} thrown."); } /*Debug.Log("else going into foreach"); * foreach (var AI in AIManager.AIVehicles) * { * if (AI.actor == lastRadarLockData.actor) * { * Debug.Log(lastRadarLockData.actor.name + " radar data found its lock " + AI.actor.name + " at id " + AI.vehicleUID + " with its own uID being " + networkUID); * lastLockingMessage.actorUID = AI.vehicleUID; * lastLockingMessage.isLocked = true; * lastLockingMessage.senderUID = networkUID; * foundLock = true; * if (Networker.isHost) * NetworkSenderThread.Instance.SendPacketAsHostToAllClients(lastLockingMessage, EP2PSend.k_EP2PSendReliable); * else * NetworkSenderThread.Instance.SendPacketToSpecificPlayer(Networker.hostID, lastLockingMessage, EP2PSend.k_EP2PSendReliable); * break; * } * }*/ if (lastWasNull) { lastWasNull = false; } } stateChanged = false; } } }
public static GameObject SpawnRepresentation(ulong networkID, Vector3D position, Quaternion rotation, bool isLeft) { if (networkID == localUID) { return(null); } int playerID = FindPlayerIDFromNetworkUID(networkID); if (playerID == -1) { Debug.LogError("Spawn Representation couldn't find a player id."); } Player player = players[playerID]; if (player.vehicle != null) { GameObject.Destroy(player.vehicle); } GameObject newVehicle = null; switch (player.vehicleType) { case VTOLVehicles.None: Debug.LogError("Vehcile Enum seems to be none, couldn't spawn player vehicle"); return(null); case VTOLVehicles.AV42C: if (null == av42cPrefab) { SetPrefabs(); } newVehicle = GameObject.Instantiate(av42cPrefab, VTMapManager.GlobalToWorldPoint(position), rotation); break; case VTOLVehicles.FA26B: if (null == fa26bPrefab) { SetPrefabs(); } newVehicle = GameObject.Instantiate(fa26bPrefab, VTMapManager.GlobalToWorldPoint(position), rotation); break; case VTOLVehicles.F45A: if (null == f45Prefab) { SetPrefabs(); } newVehicle = GameObject.Instantiate(f45Prefab, VTMapManager.GlobalToWorldPoint(position), rotation); break; } //Debug.Log("Setting vehicle name"); newVehicle.name = $"Client [{player.cSteamID}]"; Debug.Log($"Spawned new vehicle at {newVehicle.transform.position}"); if (Networker.isHost) { HealthNetworker_Receiver healthNetworker = newVehicle.AddComponent <HealthNetworker_Receiver>(); healthNetworker.networkUID = networkID; } else { HealthNetworker_ReceiverHostEnforced healthNetworker = newVehicle.AddComponent <HealthNetworker_ReceiverHostEnforced>(); healthNetworker.networkUID = networkID; } RigidbodyNetworker_Receiver rbNetworker = newVehicle.AddComponent <RigidbodyNetworker_Receiver>(); rbNetworker.networkUID = networkID; PlaneNetworker_Receiver planeReceiver = newVehicle.AddComponent <PlaneNetworker_Receiver>(); planeReceiver.networkUID = networkID; if (player.vehicleType == VTOLVehicles.AV42C || player.vehicleType == VTOLVehicles.F45A) { //Debug.Log("Adding Tilt Controller to this vehicle " + message.networkID); EngineTiltNetworker_Receiver tiltReceiver = newVehicle.AddComponent <EngineTiltNetworker_Receiver>(); tiltReceiver.networkUID = networkID; } Rigidbody rb = newVehicle.GetComponent <Rigidbody>(); AIPilot aIPilot = newVehicle.GetComponent <AIPilot>(); RotationToggle wingRotator = aIPilot.wingRotator; if (wingRotator != null) { WingFoldNetworker_Receiver wingFoldReceiver = newVehicle.AddComponent <WingFoldNetworker_Receiver>(); wingFoldReceiver.networkUID = networkID; wingFoldReceiver.wingController = wingRotator; } LockingRadar lockingRadar = newVehicle.GetComponentInChildren <LockingRadar>(); if (lockingRadar != null) { Debug.Log($"Adding LockingRadarReciever to vehicle {newVehicle.name}"); LockingRadarNetworker_Receiver lockingRadarReceiver = newVehicle.AddComponent <LockingRadarNetworker_Receiver>(); lockingRadarReceiver.networkUID = networkID; } ExteriorLightsController extLight = newVehicle.GetComponentInChildren <ExteriorLightsController>(); if (extLight != null) { ExtLight_Receiver extLightReceiver = newVehicle.AddComponent <ExtLight_Receiver>(); extLightReceiver.lightsController = extLight; extLightReceiver.networkUID = networkID; } aIPilot.enabled = false; Debug.Log($"Changing {newVehicle.name}'s position and rotation\nPos:{rb.position} Rotation:{rb.rotation.eulerAngles}"); aIPilot.kPlane.SetToKinematic(); aIPilot.kPlane.enabled = false; rb.interpolation = RigidbodyInterpolation.None; aIPilot.kPlane.enabled = true; aIPilot.kPlane.SetVelocity(Vector3.zero); aIPilot.kPlane.SetToDynamic(); rb.interpolation = RigidbodyInterpolation.Interpolate; Debug.Log($"Finished changing {newVehicle.name}\n Pos:{rb.position} Rotation:{rb.rotation.eulerAngles}"); AvatarManager.SetupAircraftRoundels(newVehicle.transform, player.vehicleType, player.cSteamID, Vector3.zero); GameObject parent = new GameObject("Name Tag Holder"); GameObject nameTag = new GameObject("Name Tag"); parent.transform.SetParent(newVehicle.transform); parent.transform.localRotation = Quaternion.Euler(0, 180, 0); nameTag.transform.SetParent(parent.transform); nameTag.AddComponent <Nametag>().SetText( SteamFriends.GetFriendPersonaName(player.cSteamID), newVehicle.transform, VRHead.instance.transform); if (isLeft != PlayerManager.teamLeftie) { aIPilot.actor.team = Teams.Enemy; } TargetManager.instance.RegisterActor(aIPilot.actor); player.leftie = isLeft; player.vehicle = newVehicle; if (!VTOLVR_Multiplayer.AIDictionaries.allActors.ContainsKey(networkID)) { VTOLVR_Multiplayer.AIDictionaries.allActors[networkID] = aIPilot.actor; VTOLVR_Multiplayer.AIDictionaries.reverseAllActors[aIPilot.actor] = networkID; } else { VTOLVR_Multiplayer.AIDictionaries.allActors.Remove(networkID); VTOLVR_Multiplayer.AIDictionaries.reverseAllActors.Remove(aIPilot.actor); VTOLVR_Multiplayer.AIDictionaries.allActors[networkID] = aIPilot.actor; VTOLVR_Multiplayer.AIDictionaries.reverseAllActors[aIPilot.actor] = networkID; } return(newVehicle); }
public IEnumerator main() { Vector3 PitchYawRoll = new Vector3(); bool tiltC = false; while (VTMapManager.fetch == null || !VTMapManager.fetch.scenarioReady) { yield return(null); } foreach (var thing in FindObjectsOfType <AIPilot>()) { Stuff += thing.gameObject.name + " "; } goOn = true; while (GoOn == false) { Stuff = ""; foreach (var thing in FindObjectsOfType <AIPilot>()) { Stuff += thing.gameObject.name + " "; } yield return(null); } AIPilot toControl = new AIPilot(); bool found = false; AIPilot[] wut = FindObjectsOfType <AIPilot>(); for (int i = 0; i < wut.Length; i++) { if (wut[i].gameObject.name.Contains(toEdit)) { toControl = wut[i]; found = true; break; } } if (!found) { Debug.LogError("Couldn't find AIPilot, defaulting to 0."); toControl = wut[0]; } toControl.commandState = AIPilot.CommandStates.Override; foreach (var thing in FindObjectsOfType <AIPilot>()) { Debug.Log(thing); } GameObject targetVehicle = toControl.gameObject; if (targetVehicle != null) { Debug.Log("GOT THE TARGET VEHICLE!!!"); } TiltController TC = targetVehicle.GetComponent <TiltController>(); if (TC != null) { tiltC = true; } Transform transform = FlightSceneManager.instance.playerActor.transform; FloatingOriginShifter playerfos = transform.GetComponent <FloatingOriginShifter>(); if (playerfos) { playerfos.enabled = false; } GameObject empty = new GameObject(); GameObject Cammy = Instantiate(empty, transform.position, Quaternion.identity); Actor targetActor = targetVehicle.GetComponent <Actor>(); // targetActor.team = Teams.Allied; Camera CammyCam = Cammy.AddComponent <Camera>(); CameraFollowMe cam = Cammy.AddComponent <CameraFollowMe>(); cam.targets = new List <Transform>(); Debug.Log("Target list created."); cam.AddTarget(targetActor.transform); Debug.Log("Added our actor to the target."); if (targetActor.transform == null) { Debug.LogError("Actor transform is null."); } if (cam.gameObject == null) { Debug.LogError("cam gameObject is null."); } cam.cam = CammyCam; cam.gameObject.SetActive(true); cam.AddTarget(FlightSceneManager.instance.playerActor.transform); GameSettings.SetGameSettingValue("HIDE_HELMET", true, true); Debug.Log("Cam should be set."); VehicleInputManager control = targetVehicle.AddComponent <VehicleInputManager>(); AutoPilot AP = targetVehicle.GetComponent <AutoPilot>(); control.pyrOutputs = AP.outputs; AP.steerMode = AutoPilot.SteerModes.Aim; List <ModuleEngine> Engines = AP.engines; AP.enabled = false; control.wheelSteerOutputs = targetVehicle.GetComponents <WheelsController>(); GearAnimator gear = toControl.gearAnimator; targetVehicle.GetComponent <AIPilot>().enabled = false; Radar targetRadar = toControl.detectionRadar; LockingRadar lTargetRadar = new LockingRadar(); if (targetRadar != null) { targetRadar.teamsToDetect = Radar.DetectionTeams.Both; lTargetRadar = toControl.lockingRadar; radarActive = true; } if (lTargetRadar != null) { lockingRadar = true; } foreach (var thing in targetVehicle.GetComponents(typeof(Component))) { Debug.Log(thing); } WeaponManager wm = targetVehicle.GetComponent <WeaponManager>(); if (wm != null) { hasWM = true; wm.SetMasterArmed(true); foreach (var internalBays in wm.internalWeaponBays) { internalBays.openOnAnyWeaponMatch = true; } } MissileDetector rwr = toControl.rwr; MeasurementManager MM = MeasurementManager.instance; float t = 0f; float v = 0f; CameraScreenshot CS = new CameraScreenshot(); PitchYawRoll = new Vector3(0f, 0f, 0f); FlightInfo FI = targetActor.flightInfo; // RefuelPlane rPlane = targetVehicle.GetComponent<RefuelPlane>(); float x = 0f; float y = 0f; float z = 0f; float flaps = 0f; float brakes = 0f; int idx = -1; int p = 2; float headingNum = 0; bool locked = false; bool tDep = false; bool hDep = false; if (toControl.tailHook != null) { tDep = toControl.tailHook.isDeployed; } if (toControl.catHook != null) { hDep = toControl.catHook.deployed; } infAmmo iA = targetVehicle.AddComponent <infAmmo>(); iA.wepMan = wm; iA.enabled = false; Actor lockSelection = new Actor(); Debug.Log("Controlling " + targetVehicle); while (true) { // Pitch Yaw Roll controls if (Input.GetKey(KeyCode.S)) { x = -1f; } else if (Input.GetKey(KeyCode.W)) { x = 1f; } else { x = 0f; } if (Input.GetKey(KeyCode.A)) { y = -1f; } else if (Input.GetKey(KeyCode.D)) { y = 1f; } else { y = 0f; } if (Input.GetKey(KeyCode.E)) { z = -1f; } else if (Input.GetKey(KeyCode.Q)) { z = 1f; } else { z = 0f; } // Tilt Controller if (Input.GetKey(KeyCode.Z)) { if (v >= 90) { } else { if (TC) { v += 1; TC.SetTiltImmediate(v); } } } if (Input.GetKey(KeyCode.X)) { if (v <= 0) { } else { if (tiltC) { v -= 1; TC.SetTiltImmediate(v); } } } // Screen Shot if (Input.GetKeyDown(KeyCode.L)) { try { if (CS.cam == null) { CS.cam = CameraFollowMe.instance.cam; Debug.Log("NULL in assigning cam to CS"); } CS.Screenshot(); } catch (NullReferenceException) { Debug.Log("This dude really tried screenshotting without having the debug cam on, LOSER!"); } } // WeaponManager code if (wm != null) { if (Input.GetKeyDown(KeyCode.R)) { wm.CycleActiveWeapons(); } if (iA.enabled) { if (Input.GetKey(KeyCode.Space)) { if (wm.currentEquip is HPEquipIRML || wm.currentEquip is HPEquipRadarML) { wm.SingleFire(); } else { wm.StartFire(); } } if (Input.GetKeyUp(KeyCode.Space)) { if (!(wm.currentEquip is HPEquipIRML || wm.currentEquip is HPEquipRadarML)) { wm.EndFire(); } } } else { if (Input.GetKeyDown(KeyCode.Space)) { if (wm.currentEquip is HPEquipIRML || wm.currentEquip is HPEquipRadarML) { wm.SingleFire(); } else { wm.StartFire(); } } if (Input.GetKeyUp(KeyCode.Space)) { if (!(wm.currentEquip is HPEquipIRML || wm.currentEquip is HPEquipRadarML)) { wm.EndFire(); } } } Weapon = wm.currentEquip.name; Ammo = wm.currentEquip.GetCount().ToString(); } // Gear Toggle if (Input.GetKeyDown(KeyCode.G)) { if (gear != null) { gear.Toggle(); } } // Thrrottle code if (Input.GetKey(KeyCode.LeftControl)) // Increase { if (t > 0) { t -= 0.0125f; } } if (Input.GetKey(KeyCode.LeftShift)) // Decrease { if (t < 1) { t += 0.0125f; } } // CMS dispenser if (Input.GetKey(KeyCode.C)) { toControl.FireFlares(); toControl.FireChaff(); } // Radar code if (targetRadar != null) { if (lTargetRadar != null) { if (Input.GetKeyDown(KeyCode.M)) // Move right in the array { idx += 1; if (idx > targetRadar.detectedUnits.Count - 1) { idx = targetRadar.detectedUnits.Count - 1; } if (targetRadar.detectedUnits.Count > 0) { lockSelection = targetRadar.detectedUnits[idx]; sRadarTargets = lockSelection.actorName; } } if (Input.GetKeyDown(KeyCode.N)) // Move left in the array { idx -= 1; if (idx < 0) { idx = 0; } if (targetRadar.detectedUnits.Count > 0) { lockSelection = targetRadar.detectedUnits[idx]; sRadarTargets = lockSelection.actorName; } } if (Input.GetKeyDown(KeyCode.J)) // Lock { if (!locked) { if (targetRadar.detectedUnits.Count > 0) { if (idx >= 0) { if (lTargetRadar.GetLock(lockSelection)) { lRadarTargets = lockSelection.ToString(); locked = !locked; } } } } else { lTargetRadar.Unlock(); lRadarTargets = "No lock"; locked = !locked; } } if (!lTargetRadar.IsLocked()) { lRadarTargets = "Lock Dropped"; if (locked) { locked = !locked; } } } radarTargets = ""; foreach (var thing in targetRadar.detectedUnits) { headingNum = Mathf.Round(VectorUtils.SignedAngle(Vector3.forward, thing.transform.forward, Vector3.right)); if (headingNum < 0) { headingNum += 360; } radarTargets += thing + " " + headingNum.ToString() + " " + MM.ConvertedDistance(Mathf.Round((targetRadar.transform.position - thing.position).magnitude)).ToString() + " " + DistanceLabel() + " " + MM.ConvertedAltitude(Mathf.Round((WaterPhysics.GetAltitude(thing.position)))).ToString() + " " + AltitudeLabel() + "\n"; } } // RWR code if (rwr != null) { Missiles = ""; if (rwr.missileDetected) { MissileDetected = true; foreach (var Missile in rwr.detectedMissiles) { headingNum = Mathf.Round(VectorUtils.SignedAngle(Vector3.forward, Missile.transform.forward, Vector3.right)); if (headingNum < 0) { headingNum += 360; } Missiles += Missile.ToString() + " " + headingNum.ToString() + " " + MM.ConvertedDistance(Mathf.Round((rwr.transform.position - Missile.transform.position).magnitude)).ToString() + " " + DistanceLabel() + " " + MM.ConvertedAltitude(Mathf.Round((WaterPhysics.GetAltitude(Missile.transform.position)))).ToString() + " " + AltitudeLabel() + "\n"; } } } // Flaps if (Input.GetKeyDown(KeyCode.F)) { if (flaps == 0f) { flaps = .5f; } else if (flaps == .5f) { flaps = 1f; } else { flaps = 0f; } foreach (var thing in toControl.autoPilot.outputs) { thing.SetFlaps(flaps); } } // Brakes if (Input.GetKeyDown(KeyCode.B)) { if (brakes == 0f) { brakes = 1f; } else { brakes = 0f; } foreach (var thing in toControl.autoPilot.outputs) { thing.SetBrakes(brakes); } } // Wing Folding if (Input.GetKeyDown(KeyCode.K)) { if (toControl.wingRotator != null) { if (toControl.wingRotator.deployed) { toControl.wingRotator.SetDefault(); } else { toControl.wingRotator.SetDeployed(); } } } // Tail Hook if (Input.GetKeyDown(KeyCode.H)) { if (toControl.tailHook != null) { if (tDep) { toControl.tailHook.RetractHook(); tDep = !tDep; } else { toControl.tailHook.ExtendHook(); tDep = !tDep; } } } // Launch Bar if (Input.GetKeyDown(KeyCode.T)) { if (toControl.catHook != null) { if (hDep) { toControl.catHook.Retract(); hDep = !hDep; } else { toControl.catHook.Extend(); hDep = !hDep; } } } // Debug if (Input.GetKeyDown(KeyCode.O)) { iA.enabled = !iA.enabled; } // Misc Stuff PitchYawRoll.Set(x, y, z); control.SetJoystickPYR(PitchYawRoll); foreach (ModuleEngine Engine in Engines) { Engine.SetThrottle(t); } headingNum = VectorUtils.SignedAngle(Vector3.forward, targetActor.transform.forward, Vector3.right); if (headingNum < 0f) { headingNum += 360f; } heading = FI.heading.ToString(); altitude = MM.ConvertedAltitude(FI.altitudeASL).ToString() + " " + AltitudeLabel(); speed = MM.ConvertedSpeed(FI.surfaceSpeed).ToString() + " " + SpeedLabel(); yield return(null); } }