Exemplo n.º 1
0
    public void AddLap()
    {
        CurrentLap++;
        if (CurrentLap == 1)
        {
            startTime   = DateTime.Now;
            bestLapSpan = new TimeSpan();
        }
        else
        {
            DateTime endTime  = DateTime.Now;
            TimeSpan interval = endTime - startTime;
            if (bestLap == "" || bestLap == "--:--:--" || interval < bestLapSpan)
            {
                bestLapSpan = interval;
                ComputeBestTime();
            }
            startTime = endTime;
        }

        if (!polePosition.clasificationLap && CurrentLap > polePosition.maxLaps)
        {
            Finish = true;
        }
        else if (polePosition.clasificationLap && CurrentLap == 2)
        {
            Speed = 0f;
            polePosition.PlayerFinishedClasificationLap(this);
            CircuitProgress.Initialize();
        }
    }