StartNewLap() публичный Метод

public StartNewLap ( int lapNumber, int position, System.Boolean inPits, float gameTimeAtStart, System.Boolean isRaining, float trackTemp, float airTemp ) : void
lapNumber int
position int
inPits System.Boolean
gameTimeAtStart float
isRaining System.Boolean
trackTemp float
airTemp float
Результат void
 private void upateOpponentData(OpponentData opponentData, int racePosition, int completedLaps, int sector, Boolean isInPits,
     float sessionRunningTime, float secondsSinceLastUpdate, float[] currentWorldPosition, float[] previousWorldPosition,
     float previousSpeed, float worldRecordLapTime, float distanceRoundTrack, Boolean isRaining, float trackTemp, float airTemp)
 {
     opponentData.DistanceRoundTrack = distanceRoundTrack;
     float speed;
     Boolean validSpeed = true;
     if ((currentWorldPosition[0] == 0 && currentWorldPosition[1] == 0) || (previousWorldPosition[0] == 0 && previousWorldPosition[1] == 0))
     {
         speed = previousSpeed;
     }
     else
     {
         speed = (float)Math.Sqrt(Math.Pow(currentWorldPosition[0] - previousWorldPosition[0], 2) + Math.Pow(currentWorldPosition[1] - previousWorldPosition[1], 2)) / secondsSinceLastUpdate;
     }
     if (speed > 500)
     {
         // faster than 500m/s (1000+mph) suggests the player has quit to the pit. Might need to reassess this as the data are quite noisy
         validSpeed = false;
         opponentData.Speed = 0;
     }
     else if (speed == 0 && previousSpeed > 5)
     {
         if (previousSpeedReuseCount.ContainsKey(opponentData.DriverRawName))
         {
             if (previousSpeedReuseCount[opponentData.DriverRawName] > 5)
             {
                 // we've reused 5 previous values, reset
                 previousSpeedReuseCount[opponentData.DriverRawName] = 0;
             }
             else
             {
                 speed = previousSpeed;
                 previousSpeedReuseCount[opponentData.DriverRawName] = previousSpeedReuseCount[opponentData.DriverRawName] + 1;
             }
         }
         else
         {
             previousSpeedReuseCount.Add(opponentData.DriverRawName, 1);
             speed = previousSpeed;
         }
     }
     opponentData.Speed = speed;
     opponentData.Position = racePosition;
     opponentData.UnFilteredPosition = racePosition;
     opponentData.WorldPosition = currentWorldPosition;
     opponentData.IsNewLap = false;
     if (opponentData.CurrentSectorNumber != sector)
     {
         if (opponentData.CurrentSectorNumber == 3 && sector == 1)
         {
             // use -1 for provided lap time and let the AddSectorData method calculate it from the game time
             if (opponentData.OpponentLapData.Count > 0)
             {
                 opponentData.CompleteLapWithEstimatedLapTime(racePosition, sessionRunningTime, worldRecordLapTime, validSpeed,
                     isRaining, trackTemp, airTemp);
             }
             opponentData.StartNewLap(completedLaps + 1, racePosition, isInPits, sessionRunningTime, isRaining, trackTemp, airTemp);
             opponentData.IsNewLap = true;
         }
         else if (opponentData.CurrentSectorNumber == 1 && sector == 2 || opponentData.CurrentSectorNumber == 2 && sector == 3)
         {
             opponentData.AddSectorData(racePosition, -1, sessionRunningTime, validSpeed, isRaining, trackTemp, airTemp);
         }
         opponentData.CurrentSectorNumber = sector;
     }
     if (sector == 3 && isInPits)
     {
         opponentData.setInLap();
     }
     opponentData.CompletedLaps = completedLaps;
 }
 private void upateOpponentData(OpponentData opponentData, int racePosition, int unfilteredRacePosition, int completedLaps, int sector, float sectorTime, 
     float completedLapTime, Boolean isInPits, Boolean lapIsValid, float sessionRunningTime, float secondsSinceLastUpdate, float[] currentWorldPosition, 
     float[] previousWorldPosition, float distanceRoundTrack, int tire_type)
 {
     opponentData.DistanceRoundTrack = distanceRoundTrack;
     float speed;
     Boolean validSpeed = true;
     speed = (float)Math.Sqrt(Math.Pow(currentWorldPosition[0] - previousWorldPosition[0], 2) + Math.Pow(currentWorldPosition[1] - previousWorldPosition[1], 2)) / secondsSinceLastUpdate;
     if (speed > 500)
     {
         // faster than 500m/s (1000+mph) suggests the player has quit to the pit. Might need to reassess this as the data are quite noisy
         validSpeed = false;
         opponentData.Speed = 0;
     }
     opponentData.Speed = speed;
     if (opponentData.Position != racePosition)
     {
         opponentData.SessionTimeAtLastPositionChange = sessionRunningTime;
     }
     opponentData.Position = racePosition;
     opponentData.UnFilteredPosition = unfilteredRacePosition;
     opponentData.WorldPosition = currentWorldPosition;
     opponentData.IsNewLap = false;
     if (opponentData.CurrentSectorNumber != sector)
     {
         if (opponentData.CurrentSectorNumber == 3 && sector == 1)
         {
             if (opponentData.OpponentLapData.Count > 0)
             {
                 opponentData.CompleteLapWithProvidedLapTime(racePosition, sessionRunningTime, completedLapTime,
                     lapIsValid && validSpeed, false, 20, 20);
             }
             opponentData.StartNewLap(completedLaps + 1, racePosition, isInPits, sessionRunningTime, false, 20, 20);
             opponentData.IsNewLap = true;
         }
         else if (opponentData.CurrentSectorNumber == 1 && sector == 2 || opponentData.CurrentSectorNumber == 2 && sector == 3)
         {
             opponentData.AddSectorData(racePosition, sectorTime, sessionRunningTime, lapIsValid && validSpeed, false, 20, 20);
             if (sector == 2)
             {
                 opponentData.CurrentTyres = mapToTyreType(tire_type);
             }
         }
         opponentData.CurrentSectorNumber = sector;
     }
     opponentData.CompletedLaps = completedLaps;
     if (sector == 3 && isInPits)
     {
         opponentData.setInLap();
     }
 }