public void SelectThisCell() { //Exit this function if it is flagged, prevent the player from selecting it if (isFlagged) { return; } value = uiBoard.GetValueAt(x, y); // if player select the cell normally, that is to open a concealed cell if (value == 'c') { uiBoard.SelectCell(x, y); UpdateCellUI(false); } //if player select a cell that is already opened and has at least a flag in 8 cells around it if (value != 'c') { if (uiBoard.CheckFlagAroundCell(x, y)) { uiBoard.SelectCellWithFlagAround(x, y); } } }