Exemple #1
0
 public CarDistance(Car car, int distance,Road road, int delay = 0 )
 {
     this.Car = car;
     this.Distance = distance;
     this.Road = road;
     this.Delay = delay;
 }
Exemple #2
0
 public bool AddCarToIncreasingLane(Car car,int distanceFromCrossroad,int delay = 0)
 {
     var targetLaneIndex = GetEmptiestIncreasingLane();
     if (SpaceOnEnterIncreasingLane(targetLaneIndex))
     {
         car.RoadProgress ++;
         IncreasingLanes[targetLaneIndex].AddLast(new CarDistance(car, distanceFromCrossroad, this, delay));
     }
     else
     {
         targetLaneIndex = SpaceOnEnterIncreasingLane();
         if (targetLaneIndex != -1)
         {
             car.RoadProgress++;
             IncreasingLanes[targetLaneIndex].AddLast(new CarDistance(car, distanceFromCrossroad, this, delay));
         }
             else
         {
             return false;
         }
     }
     return true;
 }