static List<Node> GetChildNodes(Node parent, Vector3 target, MapController map) { List<Node> children = new List<Node>(); Vector3[] directions = { Vector3.forward, Vector3.right, Vector3.back, Vector3.left }; foreach (var direction in directions) { int x = (int)parent.Position.x + (int)direction.x; int z = (int)parent.Position.z + (int)direction.z; TileType tile = map.GetTileType(x, z); if (tile.isWalkable) { children.Add(new Node(parent.Position + direction, parent.MovesFromStart + 1, CalculateTilesBetween(parent.Position + direction, target), parent)); } } return children; }