///<summary> /// Return the nth neighbor in the given direction. We've /// already counted the neighbors, so there should be no /// case of a null neighbor. ///</summary> internal GridCell NthNeighbor(GridCell cell, GridDirection direction, int n) { GridCell temp = NthNeighborOrNull(cell, direction, n); if (temp == null) throw new Exception(string.Format("Null neighbor in PathGenerator.NthNeighbor({0}, {1}, {2})", cell.ToString(), (int)direction, n)); return temp; }