private void OnSelectCell(CellView cell) { foreach (PieceDO pieceDo in _currentPool) { pieceDo.Checked = false; pieceDo.Locked = false; pieceDo.View.Cell.IsMarked = false; } _currentPool.Clear(); _selectedType = cell.Piece.GetData.Type; if (_selectedType == PieceType.MAGIC_DIAMOND) { for (int i = 0; i < _config.GetGridWidth(); i++) { _currentPool.Add(_grid[i][0]); } for (int i = 1; i < _config.GetGridHeight(); i++) { _currentPool.Add(_grid[cell.Piece.GetData.Col][i]); } _currentPool.FindAll(x => x.View.Cell != cell && (x.Type == PieceType.FRIEND_DIAMOND || x.Type == PieceType.MAGIC_DIAMOND)).ForEach((x) => _currentPool.Remove(x)); } else if (_selectedType == PieceType.FRIEND_DIAMOND) { CheckForMatches(); List <PieceDO[]> matches = new List <PieceDO[]>(_matches); _currentPool.Add(cell.Piece.GetData); _coroutineCreator.StartCoroutine(AnimateFriendDiamonds(matches)); return; } else { LookForMatches(cell, _selectedType); if (_currentPool.Count <= 2) { //TODO show this match has failed _gameView.AddDiamondProgress((int)DiamondBarState.Miss); foreach (var pieceDo in _currentPool) { pieceDo.Checked = false; pieceDo.Locked = false; pieceDo.View.Cell.IsMarked = false; } _currentPool.Clear(); return; } } SetMatch(); }