private static int FindCell(int cell, NearbyCells dir, Map map) { switch (dir) { case NearbyCells.BottomRight: return(cell + 1); case NearbyCells.Bottom: return(cell + map.Width); case NearbyCells.BottomLeft: return(cell + (map.Width * 2) - 1); case NearbyCells.Left: return(cell + map.Width - 1); case NearbyCells.TopLeft: return(cell - 1); case NearbyCells.Top: return(cell - map.Width); case NearbyCells.TopRight: return(cell - (map.Width * 2) + 1); case NearbyCells.Right: return(cell - map.Width + 1); } return(-1); }
private static int FindCell(int cell, NearbyCells dir, Map map) { switch (dir) { case NearbyCells.BottomRight: return cell + 1; case NearbyCells.Bottom: return cell + map.Width; case NearbyCells.BottomLeft: return cell + (map.Width * 2) - 1; case NearbyCells.Left: return cell + map.Width - 1; case NearbyCells.TopLeft: return cell - 1; case NearbyCells.Top: return cell - map.Width; case NearbyCells.TopRight: return cell - (map.Width * 2) + 1; case NearbyCells.Right: return cell - map.Width + 1; } return -1; }