private void UpdateGaps() { int leaderLap; double leaderTime; int prevLap; double prevTime; RaceStanding rs = this[0] as RaceStanding; if (rs.LastLapCrossing == null) { return; } rs.GapToFirst = new Support.Gap(0, 0); rs.GapToPrevious = new Support.Gap(0, 0); leaderLap = rs.Laps.Count; leaderTime = rs.LastLapCrossing.Value; prevLap = leaderLap; prevTime = rs.LastLapCrossing.Value; for (int i = 1; i < this.Count; i++) { rs = this[i] as RaceStanding; if (rs.LastLapCrossing == null) { break; } rs.GapToFirst = new Support.Gap(leaderLap - rs.Laps.Count, rs.LastLapCrossing.Value - leaderTime); rs.GapToPrevious = new Support.Gap(prevLap - rs.Laps.Count, rs.LastLapCrossing.Value - prevTime); prevLap = rs.Laps.Count; prevTime = rs.LastLapCrossing.Value; } }
public RaceStanding TryGetRaceStanding(int index) { RaceStanding ret = this[index] as RaceStanding; return(ret); }