public bool MatchesColor(GridItemController a, GridItemController b) { if (a.color == b.color) { return(true); } return(false); }
bool FindHorizontalMatches(int x, int y) { int matchesColor = 0; int matchesShape = 0; int matchTypes = 0; GridItemController a = tiles [x, y].GetComponent <GridItemController> (); for (int i = x + 1; i <= minimumMatch - 1; i++) { if (tiles [i, y].transform.tag == "Tile") { GridItemController b = tiles [i, y].GetComponent <GridItemController> (); if (a.color == b.color) { matchesColor++; } if (a.shape == b.shape) { matchesShape++; } } else { // Never going to match if we are matching against a non-tile4! return(false); } } if (matchesColor == minimumMatch) { matchTypes++; } if (matchesShape == minimumMatch) { matchTypes++; } if (matchTypes > 1) { Debug.Log("That was a bonus match!"); } if (matchTypes > 0) { Debug.Log("Horizontal match found starting at " + x + ", " + y); } return(false); }