/// <summary> /// Sets the car to the start position and enables the collision detection /// </summary> public void StartDriving(DynamicCar precursoryCar, TrafficControlSystem trafficLight) { _precursoryCar = precursoryCar; if (_precursoryCar != null) { precursoryCar._followingCar = this; } _trafficLight = trafficLight; Offset = 0.001f; // 0 is not possible because godot only sets the position with a delta. }
/// <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(); }
/// <summary> /// Initializes the path controller /// </summary> public void Setup(TrafficControlSystem referenceTrafficLight) { _trafficLight = referenceTrafficLight; _trafficLight.SetDistances(this); }