public TrafficController(PathController topPath, PathController botPath) { _topPath = topPath; _botPath = botPath; _activeCars = new List<DynamicCar>(); _carsToCollect = new List<DynamicCar>(); _reports = new List<DynamicCarReport>(); }
/// <summary> /// Initializes the whole page. Called before the node is added to the tree by the lesson controller. /// </summary> public override void InitialiseWith(IMainNode mainNode, ILessonEntity openedLesson) { _topTrafficLight = GetNode <TrafficControlSystem>("Signalisation/TrafficControlSystemTop"); _topTrafficLight.SetToGreen(SimulationInput.PollBoolean(_topTrafficLightKey)); _botTrafficLight = GetNode <TrafficControlSystem>("Signalisation/TrafficControlSystemBot"); _botTrafficLight.SetToGreen(SimulationInput.PollBoolean(_botTrafficLightKey)); PathController topPath = GetNode <PathController>("DynamicCars/TopPath"); topPath.Setup(_topTrafficLight); PathController botPath = GetNode <PathController>("DynamicCars/BotPath"); botPath.Setup(_botTrafficLight); _trafficController = new TrafficController(topPath, botPath); SpawnTimeGenerator.ResetGenerator(); }
private int CheckNextSpawnTime(PathController referencePath, int time) { if (time <= 0) { time = SpawnTimeGenerator.GetNextSpawnTime(); if (referencePath.SpawnPossible()) { DynamicCar car = (DynamicCar)((PackedScene)GD.Load(CarReference)).Instance(); car.Initialise(); referencePath.AddChildAndStart(car); _activeCars.Add(car); } } return time; }
public void SetDistances(PathController controller) { Controller = controller; _lightDistance = Controller.TrafficControlSystemDistance; }