IEnumerator UpdateVelocity() { while (true) { if (droneRacer != null) { velocityRate = (VelocityRate)PlayerPrefs.GetInt(Constants.VelocityIndicator); switch (velocityRate) { case VelocityRate.KilometersPerHour: Show(); text.text = string.Format("{0,3:0} KPH", droneRacer.kilometersPerHour); break; case VelocityRate.MilesPerHour: Show(); text.text = string.Format("{0,3:0} MPH", droneRacer.milesPerHour); break; case VelocityRate.Hidden: Hide(); break; } } else { droneRacer = DroneRacer.FindDroneRacer(); } yield return(new WaitForSeconds(updateFrequency)); } }
public void OnTriggerExit(Collider other) { //Debug.Log("OnTriggerExit other=" + other.name); DroneRacer qr = other.gameObject.GetComponent <DroneRacer>(); if (qr == DroneRacer.FindDroneRacer()) { airGate.AirGateThresholdTriggered(qr); } }
public void SetValue(int idx, bool updateToggle = true) { PlayerPrefs.SetInt(settingName, idx); DroneRacer.UpdateSettings(); if (updateToggle == true) { toggleAry[idx].isOn = true; } }
public void SetValue(bool value, bool updateToggle = true) { PlayerPrefs.SetInt(settingName, value ? 1 : 0); DroneRacer.UpdateSettings(); if (updateToggle == true) { toggle.isOn = value; } }
public static bool IsRaceInProgress() { bool retVal = false; if (IsReady() == true) { DroneRacer dr = DroneRacer.FindDroneRacer(); if (dr != null && dr.RaceStatus == RaceStatus.InProgress) { retVal = true; } } return(retVal); }
IEnumerator InvokeInit() { GameObject airGatesGO = null; while (airGatesGO == null) { airGatesGO = GameObject.Find(Constants.AirGatesName); yield return(null); } airGates.Clear(); foreach (Transform child in airGatesGO.transform) { //Debug.Log("Adding air gate " + child.gameObject.name); airGates.Add(child.gameObject.GetComponent <AirGate>()); yield return(null); } SetAirGateNumbers(); yield return(null); SetAllAirGatesNone(); droneRacer = null; while (droneRacer == null) { droneRacer = Controller.DroneRacer.FindDroneRacer(); yield return(null); } droneRacer.RaceStatus = RaceStatus.None; droneRacerArm = droneRacer.GetComponent <DroneRacerArm>(); InitLocalRaceData(); raceManagerIsReady = true; initializing = false; }
public void OnEnable() { droneRacer = null; StartCoroutine(UpdateVelocity()); }
public void SettingsClose() { gameObject.SetActive(false); DroneRacer.UpdateSettings(); }
void OnValueChanged(float value) { PlayerPrefs.SetFloat(settingName, MathHelper.ScaleToRange(value, 0, 1, min, max)); UpdateValueLabel(); DroneRacer.UpdateSettings(); }