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));
            }
        }
Пример #2
0
        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;
            }
        }
Пример #4
0
        public void SetValue(bool value, bool updateToggle = true)
        {
            PlayerPrefs.SetInt(settingName, value ? 1 : 0);

            DroneRacer.UpdateSettings();

            if (updateToggle == true)
            {
                toggle.isOn = value;
            }
        }
Пример #5
0
        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);
        }
Пример #6
0
        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());
 }
Пример #8
0
 public void SettingsClose()
 {
     gameObject.SetActive(false);
     DroneRacer.UpdateSettings();
 }
Пример #9
0
 void OnValueChanged(float value)
 {
     PlayerPrefs.SetFloat(settingName, MathHelper.ScaleToRange(value, 0, 1, min, max));
     UpdateValueLabel();
     DroneRacer.UpdateSettings();
 }