public void SimulationStep() { //Log.Warning("step: " + NodeId); var currentFrameIndex = Singleton <SimulationManager> .instance.m_currentFrameIndex; if (TimedTrafficLightsActive) { var timedNode = TrafficLightsTimed.GetTimedLight(nodeId); if (timedNode != null) { timedNode.CheckCurrentStep(); } } var node = getNode(); for (var l = 0; l < 8; l++) { var segment = node.GetSegment(l); if (segment == 0) { continue; } if (!TrafficLightsManual.IsSegmentLight(nodeId, segment)) { continue; } var segmentLight = TrafficLightsManual.GetSegmentLight(nodeId, segment); segmentLight.LastChange = (currentFrameIndex >> 6) - segmentLight.LastChangeFrame; } }
/// <summary> /// Stops & destroys the traffic light simulation(s) at this node (group) /// </summary> public void Destroy() { var node = getNode(); var timedNode = TrafficLightsTimed.GetTimedLight(nodeId); if (timedNode != null) { foreach (var timedNodeId in timedNode.NodeGroup) { var nodeSim = TrafficPriority.GetNodeSimulation(timedNodeId); // `this` is one of `nodeSim` TrafficLightsTimed.RemoveTimedLight(timedNodeId); if (nodeSim == null) { continue; } nodeSim.TimedTrafficLightsActive = false; nodeSim.TimedTrafficLights = false; } } }