Exemplo n.º 1
0
        private void WhatHappensInthePosition(List <Player> players, AbstractSquare[] board, int PlayerIndex)
        {
            AbstractSquare Square        = board[players[PlayerIndex].ACTUALPOSITION];
            Player         CurrentPlayer = players[PlayerIndex];
            Player         Owner;

            if (Square is IAbstractTitleDeed && !(((IAbstractTitleDeed)Square).OWNER is null))
            {
                Owner = ((IAbstractTitleDeed)Square).OWNER;

                if (CurrentPlayer != Owner)
                {
                    CurrentPlayer.CURRENTMONEY -= ((IAbstractTitleDeed)Square).PAYTOOWNER;
                    Owner.CURRENTMONEY         += ((IAbstractTitleDeed)Square).PAYTOOWNER;;
                }
            }
            else if (Square is CardSquare)

            {
                ActionOfCard(CurrentPlayer, (CardSquare)Square);
            }
            else if (Square is IncomeTaxSquare)
            {
                CurrentPlayer.CURRENTMONEY += ((IncomeTaxSquare)Square).TAX;
            }
            else if (Square is JailSquare && Square.POSITION == 10)
            {
                CurrentPlayer.INJAIL = true;
            }
        }
Exemplo n.º 2
0
        private void EvalutateAbstractSquare(AbstractSquare square)
        {
            if (square is PropertySquare)
            {
                Console.BackgroundColor = ((PropertySquare)square).COLOR_PROPERTY;
                if (square.POSITION == 37 || square.POSITION == 39)
                {
                    Console.ForegroundColor = ConsoleColor.White;
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.Black;
                }

                Console.Write(" " + ((PropertySquare)square).POSITION + " ");
            }
            else if (square is ServicesSquare && (square.POSITION == 5 || square.POSITION == 15 || square.POSITION == 25 || square.POSITION == 35))
            {
                Console.BackgroundColor = ConsoleColor.DarkMagenta;
                Console.ForegroundColor = ConsoleColor.White;
                Console.Write(" " + square.POSITION + " ");
            }
            else if (square is ServicesSquare)
            {
                Console.BackgroundColor = ConsoleColor.DarkCyan;
                Console.ForegroundColor = ConsoleColor.White;
                Console.Write(" " + square.POSITION + " ");
            }
            else if (square is CardSquare && ((CardSquare)square).typeofCard == TypeofCard.Community)
            {
                Console.BackgroundColor = ConsoleColor.DarkBlue;
                Console.ForegroundColor = ConsoleColor.White;
                Console.Write(" " + square.POSITION + " ");
            }
            else if (square is CardSquare && ((CardSquare)square).typeofCard == TypeofCard.Chance)
            {
                Console.BackgroundColor = ConsoleColor.DarkRed;
                Console.ForegroundColor = ConsoleColor.White;
                Console.Write(" " + square.POSITION + " ");
            }
            else
            {
                Console.BackgroundColor = ConsoleColor.Black;
                Console.ForegroundColor = ConsoleColor.White;
                Console.Write(" " + square.POSITION + " ");
            }
        }
 void FormatSquareInfo(AbstractSquare Square)
 {
     if (Square is PropertySquare)
     {
         Console.ForegroundColor = ConsoleColor.Black;
         Console.BackgroundColor = ((PropertySquare)Square).COLOR_PROPERTY;
     }
     else if (Square is ServicesSquare)
     {
         Console.BackgroundColor = ConsoleColor.DarkRed;
         Console.ForegroundColor = ConsoleColor.Green;
     }
     else
     {
         Console.BackgroundColor = ConsoleColor.Blue;
         Console.ForegroundColor = ConsoleColor.White;
     }
 }