public void Init(LapTimer _timer, int _place, int heat, List <string> summary_text)
    {
        timer = _timer;
        string summary = heat.ToString() + "," + _place.ToString() + ",";

        summary += timer.racerName + ",";

        place.text    = _place.ToString() + ".";
        userName.text = timer.racerName;

        if (timer.IsDisqualified())
        {
            dqNot.gameObject.SetActive(true);
            lap_total.gameObject.SetActive(false);
        }

        float best = timer.GetBestLapTime();

        summary += (best / 1000f).ToString("00.00") + ",";

        for (int iLap = 0; iLap < lap_times.Length; iLap++)
        {
            Text  lap_time = lap_times[iLap];
            float t        = timer.GetLapTime(iLap);

            if (t == best)
            {
                lap_time.color = bestLapTimeColor;
            }
            else
            {
                lap_time.color = lapTimeColor;
            }

            if (t != 0.0f)
            {
                lap_time.text = (t / 1000.0f).ToString("00.00");
                summary      += lap_time.text + ",";
            }
            else
            {
                summary += "00.00" + ",";
            }
        }

        float totalTime = timer.GetTotalTime();

        lap_total.text = (totalTime / 1000.0f).ToString("00.00");

        if (timer.IsDisqualified())
        {
            summary += "DQ";
        }
        else
        {
            summary += lap_total.text;
        }

        summary_text.Add(summary);
    }
예제 #2
0
    void Update()
    {
        if (timer != null)
        {
            carName.text   = comp.car_name;
            racerName.text = comp.racer_name;

            if (timer.currentTimeDisp.gameObject.activeSelf)
            {
                currentLapTime.text = timer.currentTimeDisp.text;
            }
            else
            {
                currentLapTime.text = "--:--";
            }

            if (timer.bestTimeDisp.gameObject.activeSelf)
            {
                bestLapTime.text = timer.bestTimeDisp.text;
            }
            else
            {
                bestLapTime.text = "--:--";
            }

            iLap.text = timer.GetNumLapsCompleted().ToString();
            dqNot.gameObject.SetActive(timer.IsDisqualified());
        }
    }