Exemplo n.º 1
0
    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);
    }
Exemplo n.º 2
0
    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);
    }
Exemplo n.º 3
0
 private void ConnectNodes(Intersection parent, Intersection child)
 {
     CigenFactory.CreateRoad(parent, child);
     //DrawLineBetweenPoints(parent.Position, child.Position);
 }