// Update is called once per frame
    void Update()
    {
        if (GameManager.gameState == GameState.Results)
        {
            return;
        }
        m_distanceText.text = "dist: " + NumberFormat.FloatToString(GameMetrics.totalDistance, 2) + "km";

        m_remainingLivesText.text = "shield: " + GameManager.remainingLives;
        if (GameManager.remainingLives == 1)
        {
            m_remainingLivesText.material.color = Color.red;
        }

        m_comboCountText.text = "combo " + ComboSystem.instance.currentComboCount.ToString();
    }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        m_totalTime.text = NumberFormat.FloatToString(GameMetrics.totalTime, 2);

        m_maxCombo.text = GameMetrics.maxCombo.ToString();

        m_totalDistance.text = NumberFormat.FloatToString(GameMetrics.totalDistance, 2);

        int new_achievement = GameMetrics.SetAchievement(GameMetrics.selectedTrack, (int)GameMetrics.activeGameMode, GameMetrics.totalDistance);


        AchievementBar achiev_bar = (AchievementBar)GetComponentInChildren(typeof(AchievementBar));

        if (achiev_bar)
        {
            achiev_bar.SetAchievementCount(new_achievement);
        }
    }
//	public GUIText m_topSpeed;

    // Use this for initialization
    void Start()
    {
        m_totalTime.text = NumberFormat.FloatToString(GameMetrics.totalTime, 2);

        m_averageLap.text = NumberFormat.FloatToString(GameMetrics.averageLap, 2);

        m_averageSpeed.text = NumberFormat.FloatToString(GameMetrics.avgSpeed, 2);

        //	m_topSpeed.text = GameMetrics.maxSpeed.ToString();

        int new_achievement = GameMetrics.SetAchievement(GameMetrics.selectedTrack, (int)GameMetrics.activeGameMode, GameMetrics.averageLap);

        AchievementBar achiev_bar = (AchievementBar)GetComponentInChildren(typeof(AchievementBar));

        if (achiev_bar)
        {
            achiev_bar.SetAchievementCount(new_achievement);
        }
    }
    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);
    }
Ejemplo n.º 5
0
    // Update is called once per frame
    void Update()
    {
        if (!GameManager.instance)
        {
            return;
        }

        if (GameManager.gameState == GameState.Results)
        {
            return;
        }

        //	m_distanceText.text = "dist: "+GameMetrics.totalDistance;

        m_speed.text = m_player.currentSpeed.ToString() + "km/h";
        if (m_player.currentSpeed > 100 && m_player.currentSpeed >= GameMetrics.maxSpeed)
        {
            m_speed.material.color = Color.green;
        }
        else
        {
            m_speed.material.color = Color.white;
        }

        if (m_timeLeft.enabled)
        {
            m_timeLeft.text = "time: " + GameManager.timeLeft;
            if (GameManager.timeLeft < 10)
            {
                m_timeLeft.material.color = Color.red;
            }
            else
            {
                m_timeLeft.material.color = Color.white;
            }
        }

        m_speedLevel.text = GameManager.currentSpeedLevel.ToString() + " :speed level";

        if (GameManager.currentSpeedLevel != m_prevSpeedLevel)
        {
            if (GameManager.currentSpeedLevel > m_prevSpeedLevel)
            {
                m_speedLevel.material.color = Color.green;
            }
            else
            {
                m_speedLevel.material.color = Color.red;
            }

            m_speedLevelBackToNormalTime = Time.time + 2f;
        }
        m_prevSpeedLevel = GameManager.currentSpeedLevel;

        if (Time.time > m_speedLevelBackToNormalTime && m_speedLevelBackToNormalTime > 0)
        {
            SwitchSpeedLeveLBackToNormal();
        }

        if (m_retroBoostBar)
        {
            m_retroBoostBar.SetBoostBarPercent(m_player.retroBoostComponent.normalizedReserve);

            m_retroBoostBar.SetInUse(m_player.retroBoostComponent.isActive);
        }

        if (GameManager.lapNumber > 0 && GameManager.lapTime < 5f)
        {
            //m_currentLapTime = GameManager.lapTime;
            if (m_currentLapTime < GameManager.bestLapTime)
            {
                m_lapTime.material.color = Color.green;
                m_lapTime.text           = "best lap! " + NumberFormat.FloatToString(m_currentLapTime, 2);
            }
            else
            {
                m_lapTime.text = "last lap: " + NumberFormat.FloatToString(m_currentLapTime, 2);
            }
        }
        else
        {
            m_currentLapTime         = GameManager.lapTime;
            m_lapTime.material.color = Color.white;
            m_lapTime.text           = "lap: " + NumberFormat.FloatToString(m_currentLapTime, 2);
        }
    }