public void End()
 {
     if (session != null) {
         session = null;
         bestLap = null;
     }
 }
示例#2
0
        public Lap(Session session, Track track, double startTime, int lapNumber)
        {
            this.session = session;
            this.track = track;
            this.startTime = startTime;
            this.lapNumber = lapNumber;
            this.points = new List<Point>();
            this.duration = 0;
            this.distance = 0;
            this.valid = false;
            this.splits = new double[track.NumSplits()];
            this.outLap = lapNumber == 0;

            if (outLap) { nextGate = track.start; }
        }
 public void Start(Track track)
 {
     if (session == null) {
         this.track = track;
         TimeSpan t = DateTime.UtcNow - new DateTime(1970, 1, 1);
         int secondsSinceEpoch = (int)t.TotalSeconds;
         session = new Session(track, secondsSinceEpoch);
         currentLap = new Lap(session, track, session.startTime, 0);
         session.laps.Add(currentLap);
         nextGate = track.start;
         lastPoint = null;
         lapNumber = 0;
         splitStartTime = session.startTime;
         if (bestLap != null) { bestIndex = 0; }
         splitGaps = new double[track.NumSplits()];
     }
 }