public void CreateLinks(LinkedListNode <GameObject> node) { scrNode nodeScript = node.Value.GetComponent <scrNode>(); Bounds nodeBounds = new Bounds(node.Value.transform.position, new Vector3(CELL_SIZE * 2, CELL_SIZE * 2, CELL_SIZE * 2)); // Instead, could look for nodes at the adjacent positions of positions array, derp. LinkedList <GameObject> .Enumerator activeNode = nodePool.GetEnumerator(); for (int i = 0; i < inactiveNodeCount; ++i) { activeNode.MoveNext(); } while (activeNode.MoveNext() && nodeScript.CurrentLinks != scrNode.LINKS_MAX) { // Don't link to fully infected nodes. if (nodeScript.FullyInfected ^ activeNode.Current.GetComponent <scrNode>().FullyInfected) { if (nodeBounds.Contains(activeNode.Current.transform.position)) { // Determine which order to link the nodes. if (nodeScript.FullyInfected) { nodeScript.Link(activeNode.Current); } else { activeNode.Current.GetComponent <scrNode>().Link(node.Value); } } } } }