void Update() { float val = ArduinoReciever.GetValue(measurementItem.id); if (val == 0f) { return; } measurementItem.infoLabel.text = val.ToString("0.0") + measurementItem.suffix; if (timer >= 8) { measurementItem.graphUI.AddPoint(Time.time - GeneralManager.manager.timeOffsetOfGraphClear, val); timer = 0; } timer++; Color colOut = measurementItem.gradient.Evaluate(Mathf.InverseLerp(measurementItem.minMaxValues.x, measurementItem.minMaxValues.y, val)); measurementItem.colorIndicator.color = colOut; if (measurementItem.mat != null) { measurementItem.mat.color = colOut; } //measurementItem.graphUI.AddPoint(Time.time, val); }
void Awake() { if (reciever != null) { Destroy(gameObject); } else { reciever = this; } }
public void Update() { if (Input.GetKey(KeyCode.Q)) { quitLength++; } else { quitLength = 0; } if (quitLength >= 100) { Application.Quit(); Debug.LogError("QUIT"); Debug.Break(); } if (ArduinoReciever.GetValue("pos_alt") != 0f) { altGraph.AddPoint(Time.time - timeOffsetOfGraphClear, ArduinoReciever.GetValue("pos_alt")); } bool playback = ArduinoReciever.reciever.dataPlaybackMode; if (playback) { TimeSpan diff = new TimeSpan(0, 0, ArduinoReciever.reciever.dataPlaybackTime); timelineBarTakeoffToApogee.fillAmount = Mathf.InverseLerp(0f, 30f, ArduinoReciever.reciever.dataPlaybackTime); timelineBarApogeeToLanding.fillAmount = Mathf.InverseLerp(30, 224f, ArduinoReciever.reciever.dataPlaybackTime); UpdateTimelineTimeLabels(diff); } else if (!launchQueued) { launchTimerLabel.text = "Not Set"; bigLaunchTimerLabel.text = "Not Set"; timelineBarTakeoffToApogee.fillAmount = 0f; timelineBarApogeeToLanding.fillAmount = 0f; timelineBarTakeoffToApogeeBig.fillAmount = 0f; timelineBarApogeeToLandingBig.fillAmount = 0f; } else { TimeSpan diff; diff = (playback ? FromUnixTime((long)ArduinoReciever.reciever.dataPlaybackTime) : DateTime.Now) - departureTime; timelineBarTakeoffToApogee.fillAmount = Mathf.InverseLerp(0f, 30f, (float)diff.TotalSeconds); timelineBarApogeeToLanding.fillAmount = Mathf.InverseLerp(30, 224f, (float)diff.TotalSeconds); timelineBarTakeoffToApogeeBig.fillAmount = Mathf.InverseLerp(0f, 30f, (float)diff.TotalSeconds); timelineBarApogeeToLandingBig.fillAmount = Mathf.InverseLerp(30, 224f, (float)diff.TotalSeconds); UpdateTimelineTimeLabels(diff); } }
public void Awake() { if (manager) { Destroy(gameObject); } else { manager = this; } programStartedEpochTime = ArduinoReciever.GetCurrentEpochTime(); }
void UpdateLabels() { timeThing = 0f; dateOfNewData = System.DateTime.Now; latLabel.text = ArduinoReciever.GetValue("pos_lat").ToString("0.##") + "°"; longLabel.text = ArduinoReciever.GetValue("pos_long").ToString("0.##") + "°"; ambientTempLabel.text = ArduinoReciever.GetValue("temp_ambient").ToString("0.#") + "°F"; accXLabel.text = ArduinoReciever.GetValue("acc_x").ToString("0.##"); accYLabel.text = ArduinoReciever.GetValue("acc_y").ToString("0.##"); accZLabel.text = ArduinoReciever.GetValue("acc_z").ToString("0.##"); airbrakesLabel.text = ArduinoReciever.GetValue("airbrakes_angle").ToString(); // lastUpdatedLabel.text = "Last updated " + dateOfNewData.ToLongTimeString() + " " + dateOfNewData.ToShortDateString(); //altitudeLabel.text = "Alt: " + transform.position.y.ToString(); }
void UpdatePosition() { rocketObj.transform.rotation = new Quaternion(ArduinoReciever.GetValue("rot_x"), ArduinoReciever.GetValue("rot_y"), ArduinoReciever.GetValue("rot_z"), ArduinoReciever.GetValue("rot_w")); if (ArduinoReciever.GetValue("pos_alt") != 0f) { altitudeLabel.text = ArduinoReciever.GetValue("pos_alt").ToString() + " ft"; } parachuteObj.SetActive(ArduinoReciever.GetValue("para") != 0f); float lat = ArduinoReciever.GetValue("pos_lat"); float lon = ArduinoReciever.GetValue("pos_long"); if (lat != 0f && lon != 0f) { GeneralManager.manager.SetLatLongMaps(lat, lon); } else { GeneralManager.manager.SetLatLongMaps(32.9405884f, -106.9204034f); } if (ArduinoReciever.GetValue("pos_alt") != 0f) { Vector3 rocketAlt = new Vector3(0f, ArduinoReciever.GetValue("pos_alt"), 0f); float rocketAltOffset = GeneralManager.manager.worldScaleMap.QueryElevationInUnityUnitsAt(new Mapbox.Utils.Vector2d(lat, lon)); // = GeneralManager.manager.worldScaleMap.GeoToWorldPosition(new Mapbox.Utils.Vector2d(lat, lon), true).y; rocketAlt.y += rocketAltOffset; transform.position = rocketAlt; } //parachuteObj.SetActive(true); //parachuteObj.transform.rotation = Quaternion.Inverse(transform.rotation); //transform.Translate(0f, 0.5f, 0f); return; }