/// <summary>
 /// Calculates the next simulation step.
 /// It will read the SimulationInput values and stores in the end the new values to the SimulationOutput.
 /// </summary>
 protected override void CalculateNextStep(int timeMs)
 {
     _topTrafficLight.SetToGreen(SimulationInput.PollBoolean(_topTrafficLightKey));
     _botTrafficLight.SetToGreen(SimulationInput.PollBoolean(_botTrafficLightKey));
     _trafficController.CalculateNextStep(timeMs);
     SimulationOutput.SetValue(_topTrafficSensorKey, _topTrafficLight.IsCarInRange());
     SimulationOutput.SetValue(_botTrafficSensorKey, _botTrafficLight.IsCarInRange());
 }
        /// <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();
        }