public void ConnectNode(IWeightedGraphNode <double> node, NeighbourMode neighbourMode) { AStarAlgorithm aStarAlgorithm = new AStarAlgorithm(); CoordinateTransformer transformer = new CoordinateTransformer(this, LeftBottom); foreach (var transitionNode in _transitionNodes) { IList <Vector2Int> path = aStarAlgorithm.GetPath(transformer, node.Position - LeftBottom, transitionNode.Position - LeftBottom, neighbourMode); if (path != null) { node.SetWeight(transitionNode, path.Count); transitionNode.SetWeight(node, path.Count); // Other mode will not be connected } } }