private void RefreshSelectedPod() { Pod pod = PodManager.instance.collection[PodManager.instance.selectedPod]; info.text = "Name : " + pod.name + "\nDescripton : " + pod.description; stats.text = "Maximum speed : " + ((int)(pod.GetMaxSpeed() * 3.6f)).ToString() + "km/h\n Time required to full speed : " + pod.GetTimeToFullSpeed().ToString(); engineName.text = pod.engine.name; injectorName.text = pod.injector.name; previousButton.gameObject.SetActive(PreviousPodExists()); nextButton.gameObject.SetActive(NextPodExists()); }
private void Start() { #region Optimizations rb = GetComponent <Rigidbody>(); passedCheckpoints = new List <CheckpointScript>(); #endregion #region Fetching infos from pod characteristics if (podCharacteristics != null) { maxSpeed = podCharacteristics.GetMaxSpeed(); timeToFullspeed = podCharacteristics.GetTimeToFullSpeed(); } #endregion #region Speed Approximation calculation speedCurveApproximation = new Dictionary <int, float>(); int speed = 0; float lastFactor = 0f; while (speed <= (speedCurve.Evaluate(1f) * maxSpeed)) { float factor = GetFactorForSpeed(speed, ref lastFactor); lastFactor = factor; speedCurveApproximation.Add(speed, factor); speed += 1; //Debug.Log("<color=green>added "+ speed +" = "+ factor +"</color>"); } //Debug.Log("speed 238 m/s (or 23.8 unity units/s) is achieved at ratio " + GetRatioForSpeed(238)); #endregion }