private List <Node> GetNeighbours(Node currentNode) { List <Node> neighbourList = new List <Node>(); if (grid.IsValidNeighbour(currentNode.x - 1, currentNode.y, out Node leftNeighbour)) { neighbourList.Add(leftNeighbour); } if (grid.IsValidNeighbour(currentNode.x, currentNode.y + 1, out Node upNeighbour)) { neighbourList.Add(upNeighbour); } if (grid.IsValidNeighbour(currentNode.x + 1, currentNode.y, out Node rightNeighbour)) { neighbourList.Add(rightNeighbour); } if (grid.IsValidNeighbour(currentNode.x, currentNode.y - 1, out Node downNeighbour)) { neighbourList.Add(downNeighbour); } if (grid.IsValidNeighbour(currentNode.x - 1, currentNode.y - 1, out Node downLeftNeighbour)) { neighbourList.Add(downLeftNeighbour); } if (grid.IsValidNeighbour(currentNode.x - 1, currentNode.y + 1, out Node upLeftNeighbour)) { neighbourList.Add(upLeftNeighbour); } if (grid.IsValidNeighbour(currentNode.x + 1, currentNode.y + 1, out Node upRightNeighbour)) { neighbourList.Add(upRightNeighbour); } if (grid.IsValidNeighbour(currentNode.x + 1, currentNode.y - 1, out Node downRightNeighbour)) { neighbourList.Add(downRightNeighbour); } return(neighbourList); }