Return a list of nodes that are the neighbors of node
.
By default, will only return only the neighbor nodes that are walkable.
Uses the Grid.diagonalMovement property to decide which corner neighbors
of node
should be included in the results.
Source
List<PointNode> getNeighbors(PointNode node, {bool onlyWalkable: true}) {
List<PointNode> neighbors = new List<PointNode>();
neighbors.addAll(this._getSides(node, onlyWalkable));
if (this.diagonalMovement != DiagonalMovement.Never) {
neighbors.addAll(this._getCorners(node, onlyWalkable, diagonalMovement));
}
return neighbors;
}