public void PopulateGrid(PuzzleBoard board) { PuzzleBoard = board; for (int y = 0; y < BoardConfig.Instance.Height; y++) { for (int x = 0; x < BoardConfig.Instance.Width; x++) { var thisOne = PuzzleBoard.GetGemAtPos(x, y); var newGem = GemCellPool.Instance.GetOneGemCell(thisOne); newGem.transform.parent = this.gameObject.transform; PuzzlePresentation.Instance.InitGemCell(x, y, newGem); //OnGemAdded(newGem); } } }
public bool CheckMatchAtCell(int x, int y) { int baseGem = PuzzleBoard.GetGemAtPos(x, y); int leftMatch = MatchLeftCount(x, y, baseGem); int rightMatch = MatchRightCount(x, y, baseGem); int topMatch = MatchUpCount(x, y, baseGem); int bottomMatch = MatchDownCount(x, y, baseGem); if ((leftMatch + rightMatch) > 1) { return(true); } if ((topMatch + bottomMatch) > 1) { return(true); } return(false); }