public void BuildPath() { List <Vector3> path = city.metricConstraint.ProcessPathNoEndpoints(startPosition, endPosition); Intersection start = exposedHead; Intersection end = exposedChild; if (exposedHead == null) //initialized with Init(Intersection, Intersection); { start = CigenFactory.CreateOrMergeIntersection(startPosition, city); } if (exposedChild == null) { end = CigenFactory.CreateOrMergeIntersection(endPosition, city); } Intersection curr = start; foreach (Vector3 v in path) { Intersection newIntersection = CigenFactory.CreateOrMergeIntersection(v, city); CigenFactory.CreateRoad(curr, newIntersection); curr = newIntersection; } CigenFactory.CreateRoad(curr, end); }
public Intersection CreateIntersectionAtPositionOnRoad(Vector3 position, Road road) { Intersection newIntersection = CigenFactory.CreateOrMergeIntersection(position, this); Intersection parent = road.parentNode; Intersection child = road.childNode; road.Remove(); CigenFactory.CreateRoad(parent, newIntersection); CigenFactory.CreateRoad(newIntersection, child); return(newIntersection); }
private void ConnectNodes(Intersection parent, Intersection child) { CigenFactory.CreateRoad(parent, child); //DrawLineBetweenPoints(parent.Position, child.Position); }