GenerateGraph.addNodeNeighbor C# (CSharp) Method

addNodeNeighbor() public method

Adds a neighbor to a given Node. The value of the neighbor is constructed from the sideToNode dictionary that is passed in; the dictionary requires a key specified by two Vector3 points and a laneName
public addNodeNeighbor ( Node>.Dictionary sideToNode, Node, &givenNode, Vector3 first, Vector3 second, string laneName ) : void
sideToNode Node>.Dictionary // Maps a key specified by two Vector3 points (to specify a side) and a // laneName ("middle", "outer1", or "outer2") to a Node //
givenNode Node, a Node to add a neighbor to
first Vector3 the first Vector3 point
second Vector3 the second Vector3 point
laneName string the lane name ("middle", "outer1", or "outer2")
return void
    public void addNodeNeighbor(Dictionary<string, Node> sideToNode, ref Node givenNode, 
	Vector3 first, Vector3 second, string laneName)
    {
        if (sideToNode.ContainsKey(GetPairString (first, second) + " " + laneName)) {
            Node neighbor = sideToNode[GetPairString (first, second) + " " + laneName];
            if (neighbor != givenNode) {
                givenNode.neighbors.Add (neighbor);
            }
        }
    }