public bool CheckTopAlleyRight(Coordinates current) { Coordinates check = new Coordinates(current.x, current.y + 1); if (!ShopMap.ContainsKey(check)) { return(false); } int column = current.y + 1; bool isThere = false; List <CellState> cellsProducts = new List <CellState>(); var subCells = ShopMap.Select(i => i.Key).Where(d => d.y == column && d.x <= current.x).ToList(); for (int i = 0; i < subCells.Count(); i++) { cellsProducts.Add(ShopMap[subCells[i]]); } foreach (CellState s in cellsProducts) { if (ListOfProducts.Contains(new Product(s))) { isThere = true; } } return(isThere); }
public bool IsTheItemOnListOfProductLeft(Coordinates currentCoordinates) { Coordinates check = new Coordinates(currentCoordinates.x, currentCoordinates.y - 1); if (!ShopMap.ContainsKey(check)) { return(false); } bool isThere = false; Coordinates cords = new Coordinates(currentCoordinates.x, currentCoordinates.y - 1); ShopMap.TryGetValue(cords, out CellState cell); foreach (var products in ListOfProducts) { if (ListOfProducts.Contains(new Product(cell))) { isThere = true; } } return(isThere); }