Пример #1
0
        private void SetPieceColor(Piece piece, Piece selectedPiece, bool highlight)
        {
            if (selectedPiece != null)
            {
                List <KeyValuePair <int, int> > moves = selectedPiece.GetPossibleMoves();
                foreach (KeyValuePair <int, int> move in moves)
                {
                    if (move.Key == piece.GetXlocation() && move.Value == piece.GetYlocation())
                    {
                        piece.SetTarget(true);
                    }
                }
            }

            if (piece.GetTargetStatus() && highlight)
            {
                Console.BackgroundColor = ConsoleColor.DarkYellow;
            }

            this.SetForegroundColor(piece.ReturnColor(), piece);

            Console.Write(piece.ReturnPiece());
            Console.ResetColor();
        }