// Update is called once per frame
    void Update()
    {
        var controller = car.GetComponent <CarController>();
        var angle      = controller.angle;
        var forward    = controller.forward;

        speedText.text = "S " + f(controller.velocity);
        turnText.text  = "T " + f(angle);
        if (Mathf.Abs(angle) < Mathf.Epsilon)
        {
            turnText.text = "";
        }
        else if (angle > 0)
        {
            turnText.text = "  " + f(angle) + " >";
        }
        else
        {
            turnText.text = "< " + f(-angle);
        }
        if (controller.brake > Mathf.Epsilon)
        {
            throttleText.color = Color.red;
            throttleText.text  = "BRK";
        }
        else if (Mathf.Abs(forward) < Mathf.Epsilon)
        {
            throttleText.color = Color.blue;
            throttleText.text  = "IDLE";
        }
        else if (forward > 0)
        {
            throttleText.color = Color.green;
            throttleText.text  = "F " + f(forward);
        }
        else
        {
            throttleText.color = Color.red;
            throttleText.text  = "REV";
        }

        if (lap != null)
        {
            if (lap.bestLap < lap.lastLap)
            {
                lapText.text = "LAP " + LapTimeDisplay.FormattedTime(lap.lastLap) + " (+" + LapTimeDisplay.FormattedDiff(lap.lastLap - lap.bestLap) + ")";
            }
            else
            {
                lapText.text = "LAP " + LapTimeDisplay.FormattedTime(lap.lastLap);
            }
        }
        else
        {
            lapText.text = "";
        }
    }
Exemplo n.º 2
0
        private void NewLapTimesDisplay(LapTimesDisplayInfo displayInfo)
        {
            ITelemetryDisplay display = new LapTimeDisplay()
            {
                Size        = new System.Drawing.Size(displayInfo.Width, displayInfo.Height),
                Location    = new System.Drawing.Point(displayInfo.X, displayInfo.Y),
                DisplayInfo = displayInfo
            };

            _displayController.AddDisplay(display);
        }