Esempio n. 1
0
        private void SnipePiece(TriTileView ttvClicked)
        {
            bool currentPlayerIsBlack = _coercioCtx.IsBlackTurn;

            if ((!ttvClicked.TriTile.IsBlack && !_coercioCtx.IsBlackTurn)
                  || (ttvClicked.TriTile.IsBlack && _coercioCtx.IsBlackTurn))
                return;

            _clickedTileView = ttvClicked;
            _snipeMode = false;

            foreach (var triTileChanged in _coercioCtx.OppositePieces())
                _triTile2TriTileView[triTileChanged].Piece.Opacity = MAX_OPACITY;

            var triTilesChanged = _coercioCtx.SnipePiece(_clickedTileView.TriTile);
            UpdateBoard(triTilesChanged, currentPlayerIsBlack);
            ClearTmpPieces();

            if (_isVersusAI)
                _isNextTurnAI = true;

            if(_isNextTurnAI && !_coercioCtx.IsGameOver())
                MakeAIMove();
        }
Esempio n. 2
0
        private void DrawMoveableTargets(TriTileView ttvClicked)
        {
            if ((ttvClicked.TriTile.IsBlack && !_coercioCtx.IsBlackTurn)
                    || (!ttvClicked.TriTile.IsBlack && _coercioCtx.IsBlackTurn))
                return;

            _clickedTileView = ttvClicked;

            ClearTmpPieces();
            TriTile triTile = _clickedTileView.TriTile;

            foreach (var moveableTriTile in _coercioCtx.MoveableTiles(triTile))
            {
                var ttv = _triTile2TriTileView[moveableTriTile];
                Point center = ttv.CenterPoint;

                Path piece = DrawPiece(center, moveableTriTile.IsBlack, true);
                ttv.Piece = piece;
                _point2TmpTriTileView[center] = ttv;
                LayoutGameBoard.Children.Add(piece);
            }

            UpdateSideBar(_coercioCtx.IsBlackTurn);
        }