public static GetSegmentLight ( ushort nodeId, int segmentId ) : |
||
nodeId | ushort | |
segmentId | int | |
return |
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; } }
public long CheckNextChange(ushort segmentId, int lightType) { var curStep = CurrentStep; var nextStep = CurrentStep + 1; var numFrames = Steps[CurrentStep].MaxTimeRemaining(); RoadBaseAI.TrafficLightState currentState; if (lightType == 0) { currentState = TrafficLightsManual.GetSegmentLight(nodeId, segmentId).GetLightMain(); } else if (lightType == 1) { currentState = TrafficLightsManual.GetSegmentLight(nodeId, segmentId).GetLightLeft(); } else if (lightType == 2) { currentState = TrafficLightsManual.GetSegmentLight(nodeId, segmentId).GetLightRight(); } else { currentState = TrafficLightsManual.GetSegmentLight(nodeId, segmentId).GetLightPedestrian(); } while (true) { if (nextStep == curStep) { numFrames = 99; break; } var light = Steps[nextStep].GetLight(segmentId, lightType); if (light != currentState) { break; } else { numFrames += Steps[nextStep].maxTime; } nextStep = (nextStep + 1) % NumSteps(); } return(numFrames); }