private void clearSelectedCell() { if (SelectedCell != null) { SelectedCell.DeselectCell(); SelectedCell = null; } }
private void selectCell(CellViewModel cellVM) { // Deselect old cell first if (SelectedCell != null && SelectedCell != cellVM) { SelectedCell.DeselectCell(); } // Don't reselect the same cell. Treat it as a deselect instead and bail out. if (SelectedCell == cellVM) { clearSelectedCell(); return; } // Note the select and signal the cell's viewmodel that it make the cell/peg look selected. SelectedCell = cellVM; var holdPosition = PegHoldPosition.position; cellVM.SelectCell(holdPosition); // Audio feedback of select audioManager.PlaySelect(); }