private IEnumerator spinGuage(DashHSI hsi, float fakeHeading = 999) { if (fakeHeading == 999) { fakeHeading = hsi.flightInfo.heading + 1; } else { fakeHeading = fakeHeading + 1; } if (fakeHeading > 360) { fakeHeading = -180; } if (hsi != null) { //Debug.Log($"Setting Heading to {fakeHeading}"); Destroy(hsi.flightInfo); hsi.compassTf.localRotation = Quaternion.Slerp(hsi.compassTf.localRotation, Quaternion.Euler(0f, 0f, fakeHeading), hsi.compassSlerpRate * Time.deltaTime); } else { //Debug.Log("It seems that the HSI is null"); } yield return(new WaitForSeconds(.0000001f)); if (running) { this.StartCoroutine(spinGuage(hsi, fakeHeading)); } }
public override void Run() { base.Run(); GameObject currentVehicle = VTOLAPI.instance.GetPlayersVehicleGameObject(); DashHSI hsi = currentVehicle.GetComponentInChildren <DashHSI>(); running = true; StartCoroutine(spinGuage(hsi)); }