Esempio n. 1
0
        private void SteppedOnCommunityChestSpace(Player[] players, IList <Space> listOfSpaces,
                                                  CommunityChestSpace CommunityChestSpaceObject, ChanceSpace ChanceSpaceObject, int currentPlayerCounter,
                                                  Player player, Space currentSpace)
        {
            ChanceCard drawCommunityChestCard = CommunityChestSpaceObject.DrawCard();

            if (drawCommunityChestCard is SpaceCard)
            {
                SpaceCard drawChanceCardAsSpaceCard = drawCommunityChestCard as SpaceCard;
                player.Position = drawChanceCardAsSpaceCard.PositionToGo;
                currentSpace    = listOfSpaces[player.Position];
                CheckSpaces(players, listOfSpaces, CommunityChestSpaceObject, ChanceSpaceObject, currentPlayerCounter, player, currentSpace);
            }
            if (drawCommunityChestCard is MoveCard)
            {
                MoveCard drawChanceCardAsMoveCard = drawCommunityChestCard as MoveCard;
                player.Position = drawChanceCardAsMoveCard.SquaresToMove + player.Position;
                currentSpace    = listOfSpaces[player.Position];
                CheckSpaces(players, listOfSpaces, CommunityChestSpaceObject, ChanceSpaceObject, currentPlayerCounter, player, currentSpace);
            }
            if (drawCommunityChestCard is GoodLuckCard)
            {
                GoodLuckCard drawChanceCardAsMoveCard = drawCommunityChestCard as GoodLuckCard;
                player.AddCash((int)drawChanceCardAsMoveCard.Cash);
            }
        }
Esempio n. 2
0
 private void CheckSpaces(Player[] players, IList <Space> listOfSpaces, CommunityChestSpace CommunityChestSpaceObject, ChanceSpace ChanceSpaceObject, int currentPlayerCounter, Player player, Space currentSpace)
 {
     //Case if the Player stepped on a property space
     if (currentSpace is PropertySpace)
     {
         SteppedOnPropertySpace(players, listOfSpaces, currentPlayerCounter, player, currentSpace);
     }
     //Case if the Player stepped on a Utility space
     if (currentSpace is UtilitySpace)
     {
         SteppedOnUtilitySpace(players, listOfSpaces, currentPlayerCounter, player, currentSpace);
     }
     //Case if the Player stepped on a RailRoad space
     if (currentSpace is RailRoad)
     {
         SteppedOnRailRoadSpace(players, listOfSpaces, currentPlayerCounter, player, currentSpace);
     }
     //Case if the Player stepped on a Chance space
     if (currentSpace is ChanceSpace)
     {
         SteppedOnChanceSpace(players, listOfSpaces, CommunityChestSpaceObject, ChanceSpaceObject,
                              currentPlayerCounter, player, currentSpace);
     }
     //Case if the Player stepped on a Community Chest Space
     if (currentSpace is CommunityChestSpace)
     {
         SteppedOnCommunityChestSpace(players, listOfSpaces, CommunityChestSpaceObject, ChanceSpaceObject,
                                      currentPlayerCounter, player, currentSpace);
     }
     if (currentSpace is Tax)
     {
         Tax currentTaxSpace = (Tax)currentSpace;
         player.RemoveCash(currentTaxSpace.TaxToPay);
     }
     if (currentSpace is GoToPrison)
     {
         player.Position = GameManager.JailPosition;
         currentSpace    = listOfSpaces[player.Position];
         CheckSpaces(players, listOfSpaces, CommunityChestSpaceObject, ChanceSpaceObject, currentPlayerCounter, player, currentSpace);
     }
     //TODO PLAYER IS ON JAIL SPACE
 }