public void Init(TrafSystem system) { giveWayEntries = new List <TrafEntry>(); foreach (int i in path.giveWayTo) { giveWayEntries.Add(system.GetEntry(identifier, i)); } }
public void Init(TrafSystem system) { giveWayEntries = new List <TrafEntry>(); foreach (int i in path.giveWayTo) { var e = system.GetEntry(identifier, i); if (e == null) { Debug.Log($"{identifier}_{i} is null givewayto entry when init"); } giveWayEntries.Add(system.GetEntry(identifier, i)); } }
public static void GoAll(TrafSystem trafSystem) { var allIntersections = Object.FindObjectsOfType(typeof(TrafIntersection)) as TrafIntersection[]; lightTable = new Dictionary <GameObject, TrafficLightContainer>(); foreach (var t in allIntersections) { int sub = 0; foreach (var p in t.paths) { if (t.trafSystem == null) { t.trafSystem = trafSystem; } t.trafSystem.DeleteIntersectionIfExists(t.systemId, sub); p.subId = sub; var i = new TrafEntry(); i.identifier = 1000 + t.systemId; i.subIdentifier = sub++; i.intersection = t; i.path = p; i.road = GetRoad(p); i.waypoints = new List <Vector3>(); i.spline = new List <SplineNode>(); i.spline.Add(new SplineNode() { position = p.start.transform.position, tangent = p.start.transform.forward }); i.spline.Add(new SplineNode() { position = p.end.transform.position, tangent = p.end.transform.forward }); foreach (var v in i.road.waypoints) { i.waypoints.Add(v.position); } i.light = GetLight(p.light); t.trafSystem.intersections.Add(i); //p.start.renderer.enabled = false; //p.end.renderer.enabled = false; } } lightTable.Clear(); }