public TrafficLightSimulation(ushort nodeId) { // Log._Debug($"TrafficLightSimulation: Constructor called @ node {nodeId}"); this.nodeId = nodeId; timedLight = null; type = TrafficLightSimulationType.None; }
public bool DestroyManualTrafficLight() { if (IsTimedLight()) { return(false); } if (!IsManualLight()) { return(false); } Type = TrafficLightSimulationType.None; Constants.ManagerFactory.CustomSegmentLightsManager.RemoveNodeLights(NodeId); return(true); }
public bool SetUpManualTrafficLight() { if (IsTimedLight()) { return(false); } Constants.ServiceFactory.NetService.ProcessNode(NodeId, delegate(ushort nId, ref NetNode node) { Constants.ManagerFactory.TrafficLightManager.AddTrafficLight(nId, ref node); return(true); }); Constants.ManagerFactory.CustomSegmentLightsManager.AddNodeLights(NodeId); Type = TrafficLightSimulationType.Manual; return(true); }
public bool DestroyTimedTrafficLight() { if (!IsTimedLight()) { return(false); } Type = TrafficLightSimulationType.None; var timedLight = TimedLight; TimedLight = null; if (timedLight != null) { timedLight.Destroy(); } return(true); }
public bool SetUpTimedTrafficLight(IList <ushort> nodeGroup) { if (IsManualLight()) { DestroyManualTrafficLight(); } if (IsTimedLight()) { return(false); } Constants.ServiceFactory.NetService.ProcessNode(NodeId, delegate(ushort nId, ref NetNode node) { Constants.ManagerFactory.TrafficLightManager.AddTrafficLight(nId, ref node); return(true); }); Constants.ManagerFactory.CustomSegmentLightsManager.AddNodeLights(NodeId); TimedLight = new TimedTrafficLights(NodeId, nodeGroup); Type = TrafficLightSimulationType.Timed; return(true); }