Beispiel #1
0
        public void ShowValidMovePieces(ValidMove validMove)
        {
            Coordinate      sourceCoordinate = validMove.Source;
            GamePieceVisual sourcePiece      = coordinatePieceMap[sourceCoordinate] as GamePieceVisual;

            sourcePiece.PieceState  = PieceState.ValidSource;
            sourcePiece.Highlighted = true;
            sourcePiece.Redraw();

            foreach (Coordinate destinationCoordinate in validMove.Destinations)
            {
                GamePieceVisual destinationPiece = coordinatePieceMap[destinationCoordinate] as GamePieceVisual;
                destinationPiece.PieceState = PieceState.ValidDestination;
                destinationPiece.Redraw();
            }
        }
Beispiel #2
0
        void ShowDestinations(GamePieceVisual gamePiece)
        {
            pendingSourcePiece = gamePiece;
            ValidMove targetMove = null;
            ReadOnlyCollection <ValidMove> moves = board.GetValidMoves();

            foreach (ValidMove move in moves)
            {
                if (coordinatePieceMap[move.Source] == gamePiece)
                {
                    targetMove = move;
                    break;
                }
            }

            ShowValidMovePieces(targetMove);
            //RedrawAllPieces();
            turnState = TurnState.ShowingDestinations;
        }