// Return true if this navigation region is above compareTo. // We do so by scanning the bottom row. If any tile position // along the bottom row touches one in compareTo, return true. public bool Above(NavigationRegion compareTo) { bool result = false; for (int j = Column; j < Column + Width; j++) { if (compareTo.Contains(Row - 1, j)) { result = true; break; } } return(result); }
// Return true if this navigation region is right of compareTo. // We do so by scanning the leftmost column. If any tile position // along the left most column touches one in compareTo, return true. public bool RightOf(NavigationRegion compareTo) { bool result = false; for (int i = Row; i < Row + Height; i++) { if (compareTo.Contains(i, Column - 1)) { result = true; break; } } return(result); }