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(); } }
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; }