internal static void SetUpModelingProcessor(ModelingForm modelingForm, MappedTopology mappedTopology) { CashCounter = mappedTopology.CashCounter; FuelDispensersList = mappedTopology.FuelDispensersList; FuelTanksList = mappedTopology.FuelTanksList; _isCollectingMoney = false; _isRefilling = false; CarMover.SetUpCarMover(modelingForm); CarRouter.SetUpCarRouter(modelingForm); RefuellerMover.SetUpRefuellerMover(modelingForm); }
internal static void Tick(ModelingForm modelingForm, MappedTopology mappedTopology) { if (IsPaused) { return; } TimerTicksCount++; TicksAfterLastCarSpawning++; if (TimeAfterLastCarSpawningInSeconds >= TimeBetweenCars) { CarCreator.SpawnCar(); TimeBetweenCars = ModelSettings.TrafficFlow.TimeBetweenCars; TicksAfterLastCarSpawning = 0; } //if (!_paused) //{ // //return; // //CarCreator.SpawnCar(); // CarCreator.SpawnCollector(); // _paused = true; //} //if (TimerTicksCount % 20 == 0) //{ // CarCreator.SpawnCar(); //} #region LoopingControls var panelPlayground = modelingForm.PlaygroundPanel; foreach (Control control in panelPlayground.Controls) { if (!(control is MoveablePictureBox)) { continue; } var moveablePictureBox = control as MoveablePictureBox; // Car if (moveablePictureBox is CarPictureBox car) { CarRouter.RouteCar(car); CarMover.MoveCarToDestination(car); continue; } // Collector if (moveablePictureBox is CollectorPictureBox collector) { CarRouter.RouteCar(collector); CarMover.MoveCarToDestination(collector); continue; } // Refueller if (moveablePictureBox is RefuellerPictureBox refueller) { RefuellerRouter.RouteRefueller(refueller); RefuellerMover.MoveRefuellerToDestination(refueller); } } #endregion /LoopingControls #region UI UpdateUI(modelingForm, mappedTopology); #endregion UI }