Ejemplo n.º 1
0
    public void UpdateHighScores()
    {
        TrackStats track    = GetOrCreate(GameManager.instance.raceInfo.selectedTrack.sceneName);
        RaceInfo   raceInfo = GameManager.instance.raceInfo;

        string lastName;
        float  lastValue;

        if (raceInfo.fastestLap < track.fastestLap.valueInSeconds || track.fastestLap.valueInSeconds == 0)
        {
            lastName  = track.fastestLap.name;
            lastValue = track.fastestLap.valueInSeconds;

            track.fastestLap.valueInSeconds = raceInfo.fastestLap;
            track.fastestLap.name           = "Default";
            Debug.Log("NEW FASTEST LAP!");
            Debug.Log(string.Format("Last Fastest: {0} -{1}", raceInfo.parseTimeFromSeconds(lastValue), lastName));
        }
        if (raceInfo.totalSeconds < track.fastestTotal.valueInSeconds || track.fastestTotal.valueInSeconds == 0)
        {
            lastName  = track.fastestTotal.name;
            lastValue = track.fastestTotal.valueInSeconds;

            track.fastestTotal.valueInSeconds = raceInfo.totalSeconds;
            track.fastestTotal.name           = "Default";
            track.ghost = GameManager.instance.playerGhostData.trackData;

            Debug.Log("NEW FASTEST TOTAL!");
            Debug.Log(string.Format("Last Total: {0} -{1}", raceInfo.parseTimeFromSeconds(lastValue), lastName));
        }

        track.totalPlayTime += raceInfo.totalSeconds;
    }
Ejemplo n.º 2
0
    public void CompleteLap()
    {
        //debug to console, goto next lap, reset lap timer.
        Debug.Log("Lap: " + raceInfo.parseTimeFromSeconds(raceInfo.currentLapTime));

        raceInfo.lapTimes[raceInfo.currentLap] = raceInfo.currentLapTime;
        raceInfo.currentLap++;

        raceInfo.currentLapTime = 0.0f;

        //last lap check
        CheckLastLap();

        //end race check
        if (raceInfo.currentLap == raceInfo.numberOfLaps)
        {
            EndRace();
        }
    }