コード例 #1
0
    public void Init()
    {
        GameMetrics.LoadAchievements();

        int    runs = GameMetrics.GetTotalRuns();
        string num  = runs.ToString();

        if (runs < 100)
        {
            num = "0" + num;
            if (runs < 10)
            {
                num = "0" + num;
            }
        }

        m_trackName.text = "Track " + GameMetrics.selectedTrack + " -- Run " + num;

        ////////
        //records

        m_topSpeedRecord.text  = ((int)GameMetrics.GetRecordSpeed()).ToString();
        m_topSpeedRecord.text += " kph";

        m_fastestLapRecord.text  = NumberFormat.FloatToString(GameMetrics.GetRecordLap(), 2);
        m_fastestLapRecord.text += " s";

        m_distanceRecord.text  = NumberFormat.FloatToString(GameMetrics.GetRecordDistance(), 2);
        m_distanceRecord.text += " km";

        ////////
        ///
        ///

        m_currentTopSpeed = 100;
        m_targetTopSpeed  = ((int)GameMetrics.maxSpeed);
        //	m_targetTopSpeed = 200;
        m_topSpeed.text = "0 kph";

        if (GameMetrics.bestLap < 1000)
        {
            m_fastestLap.text  = NumberFormat.FloatToString(GameMetrics.bestLap, 2);
            m_fastestLap.text += " s";
        }
        else
        {
            m_fastestLap.text = "n/a";
        }

        m_distance.text  = NumberFormat.FloatToString(GameMetrics.totalDistance, 2);
        m_distance.text += " km";

        if (GameMetrics.bestLap < GameMetrics.GetRecordLap())
        {
            m_fastestLapRecord.text           = m_fastestLap.text;
            m_fastestLapRecord.material.color = Color.green;
            m_fastestLap.material.color       = Color.green;
        }
        if (GameMetrics.totalDistance > GameMetrics.GetRecordDistance())
        {
            m_distanceRecord.text           = m_distance.text;
            m_distanceRecord.material.color = Color.green;
            m_distance.material.color       = Color.green;
        }

        GameMetrics.SetSpeedResults();

        m_active = false;

        //	gameObject.SetActiveRecursively(false);
    }