public bool ExistItemInListForRemove(ItemsCoordonate item) { foreach (var element in listForRemove) { if (element.column == item.column && element.row == item.row) { return(true); } } return(false); }
public void FindMatchItems(bool vertical) { int countElements = 0; int typeElement = 0; List <ItemsCoordonate> tempList = new List <ItemsCoordonate> (); for (int i = 0; i < gameSize; i++) { countElements = 0; for (int j = 0; j < gameSize; j++) { int i1; int j1; if (vertical) { i1 = j; j1 = i; } else { i1 = i; j1 = j; } if (countElements == 0) { tempList = new List <ItemsCoordonate> (); typeElement = instantiateItems [i1] [j1].type; countElements = 1; ItemsCoordonate a = new ItemsCoordonate(); a.row = i1; a.column = j1; tempList.Add(a); } else if (typeElement == instantiateItems [i1] [j1].type) { countElements++; ItemsCoordonate a = new ItemsCoordonate(); a.row = i1; a.column = j1; tempList.Add(a); if (j == gameSize - 1) { if (countElements >= 3) { AddInListForRemove(tempList, group); group++; tempList = new List <ItemsCoordonate> (); typeElement = instantiateItems [i1] [j1].type; countElements = 1; a = new ItemsCoordonate(); a.row = i1; a.column = j1; tempList.Add(a); } } } else if (typeElement != instantiateItems [i1] [j1].type) { if (countElements >= 3) { AddInListForRemove(tempList, group); group++; } tempList = new List <ItemsCoordonate> (); typeElement = instantiateItems [i1] [j1].type; countElements = 1; ItemsCoordonate a = new ItemsCoordonate(); a.row = i1; a.column = j1; tempList.Add(a); } } } }