Exemplo n.º 1
0
        /// <summary>
        /// Performs the action for the player's new location based on what type of tile it is.
        /// </summary>
        /// <param name="player">Current Player</param>
        private void LocationResponse(Player player)
        {
            // if the player lands on a propertym display pay rent or purchase property form
            if (GameLoop.getInstance().Gameboard.TileOrder[player.Location].GetType() == typeof(Basic) ||
                GameLoop.getInstance().Gameboard.TileOrder[player.Location].GetType() == typeof(Utility) ||
                GameLoop.getInstance().Gameboard.TileOrder[player.Location].GetType() == typeof(Railroad))
            {
                Property property = (Property)GameLoop.getInstance().Gameboard.TileOrder[player.Location];
                DisplayPayRentOrPurchasePropertyForm(player, property);

                DisplayCurrentPlayerProperties(player);      // GUI
            } // when a player lands on a community chest spot or chance spot
            else if (GameLoop.getInstance().Gameboard.TileOrder[player.Location].GetType() == typeof(CardSpace))
            {
                // Get the cardSpace and display the community or chance form
                CardSpace cardTile = (CardSpace)GameLoop.getInstance().Gameboard.TileOrder[player.Location];
                DisplayCommunityOrChanceForm(player, cardTile);
                // if the community or chance card calls for the player to advance to a property, display pay rent or purchase property form
                if (cardTile.ProcessedCard[0, 1] == "Advance" && (GameLoop.getInstance().Gameboard.TileOrder[player.Location].GetType() == typeof(Basic) ||
                                                                  GameLoop.getInstance().Gameboard.TileOrder[player.Location].GetType() == typeof(Utility) ||
                                                                  GameLoop.getInstance().Gameboard.TileOrder[player.Location].GetType() == typeof(Railroad)))
                {
                    DisplayCurrentPlayerMoney(player);
                    DisplayPayRentOrPurchasePropertyForm(player, (Property)GameLoop.getInstance().Gameboard.TileOrder[player.Location]);
                } // if the community or chance card calls for the player to advance to a card space, display community or chance card form
                else if (cardTile.ProcessedCard[0, 1] == "Advance" && (GameLoop.getInstance().Gameboard.TileOrder[player.Location].GetType() == typeof(CardSpace)))
                {
                    DisplayCurrentPlayerMoney(player);
                    DisplayCommunityOrChanceForm(player, (CardSpace)GameLoop.getInstance().Gameboard.TileOrder[player.Location]);
                } // if the community or chance card calls for the player to advance to the go to jail space, send the player to jail
                else if (cardTile.ProcessedCard[0, 1] == "Advance" && (GameLoop.getInstance().Gameboard.TileOrder[player.Location].GetType() == typeof(GoToJail)))
                {
                    GoToJail goToJailTile = (GoToJail)GameLoop.getInstance().Gameboard.TileOrder[player.Location];
                    goToJailTile.LocationAction(player);
                } // if the community or chance card calls for the player to advance to the go to Income Tax, decrease the player's money by 10% (if more) or pay $200
                else if (cardTile.ProcessedCard[0, 1] == "Advance" && (GameLoop.getInstance().Gameboard.TileOrder[player.Location].GetType() == typeof(FreeParking)))
                {
                    FreeParking freeParking = (FreeParking)GameLoop.getInstance().Gameboard.TileOrder[player.Location];
                    PayTaxForm(player, freeParking);
                }
            } // if Luxury Tax or Income Tax, display tax form
            else if (GameLoop.getInstance().Gameboard.TileOrder[player.Location].GetType() == typeof(FreeParking))
            {
                FreeParking freeParking = (FreeParking)GameLoop.getInstance().Gameboard.TileOrder[player.Location];
                if (freeParking.Name == "Income Tax" || freeParking.Name == "Luxury Tax")
                {
                    PayTaxForm(player, freeParking);
                }
            }
            // if not a property or community chest or chance card, call location action on that tile
            else
            {
                GameLoop.getInstance().Gameboard.TileOrder[player.Location].LocationAction(player);
            }
            DisplayCurrentPlayerMoney(player);      // GUI
            DisplayCurrentPlayerLocation(player);
            DisplayCurrentPlayerProperties(player);
            UpdateBoard(player);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Displays the tax form for Income Tax or Luxury Tax
        /// </summary>
        /// <param name="player"></param>
        /// <param name="freeParking"></param>
        private void PayTaxForm(Player player, FreeParking freeParking)
        {
            Tax taxfrm = new Tax();

            taxfrm.tbTileType.Text = freeParking.Name;
            taxfrm.tbOutput.Text   = "Pay $" + freeParking.AmountToPay;
            taxfrm.ShowDialog();
        }
Exemplo n.º 3
0
        private void BtnOk_Click(object sender, RoutedEventArgs e)
        {
            // Get the current player, player location, and CardSpace that the player landed on
            Player      currentPlayer         = GameLoop.getInstance().Gameboard.Players[GameLoop.getInstance().Gameboard.CurrentPlayerIndex];
            int         playerCurrentLocation = currentPlayer.Location;
            FreeParking freeParking           = (FreeParking)GameLoop.getInstance().Gameboard.TileOrder[playerCurrentLocation];

            // Carry out the specifications of the free parking
            freeParking.LocationAction(currentPlayer);
            this.Close();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes all the tiles in the game and stores them in order.
        /// </summary>
        private void InitializeTileOrder()
        {
            _TileOrder = new Tile[40];

            _TileOrder[0]  = new PassGo();
            _TileOrder[1]  = new Basic("Mediterranean Avenue", 60, 2);
            _TileOrder[2]  = new CardSpace("Community Chest");
            _TileOrder[3]  = new Basic("Baltic Avenue", 80, 4);
            _TileOrder[4]  = new FreeParking("Income Tax"); //IncomeTax
            _TileOrder[5]  = new Railroad("Reading Railroad", 200, 25);
            _TileOrder[6]  = new Basic("Oriental Avenue", 100, 6);
            _TileOrder[7]  = new CardSpace("Chance");
            _TileOrder[8]  = new Basic("Vermont Avenue", 100, 6);
            _TileOrder[9]  = new Basic("Connecticut Avenue", 120, 8);
            _TileOrder[10] = new Jail();
            _TileOrder[11] = new Basic("St. Charles Place", 140, 10);
            _TileOrder[12] = new Utility("Electric Company", 150, 1);
            _TileOrder[13] = new Basic("States Avenue", 140, 10);
            _TileOrder[14] = new Basic("Virginia Avenue", 160, 12);
            _TileOrder[15] = new Railroad("Pennsylvania Railroad", 200, 25);
            _TileOrder[16] = new Basic("St. James Place", 180, 14);
            _TileOrder[17] = new CardSpace("Community Chest");
            _TileOrder[18] = new Basic("Tennessee Avenue", 180, 14);
            _TileOrder[19] = new Basic("New York Avenue", 200, 16);
            _TileOrder[20] = new FreeParking();
            _TileOrder[21] = new Basic("Kentucky Avenue", 220, 18);
            _TileOrder[22] = new CardSpace("Chance");
            _TileOrder[23] = new Basic("Indiana Avenue", 220, 18);
            _TileOrder[24] = new Basic("Illinois Avenue", 240, 20);
            _TileOrder[25] = new Railroad("B & O Railroad", 200, 25);
            _TileOrder[26] = new Basic("Atlantic Avenue", 260, 22);
            _TileOrder[27] = new Basic("Ventnor Avenue", 260, 22);
            _TileOrder[28] = new Utility("Water Works", 150, 1);
            _TileOrder[29] = new Basic("Marvin Gardens", 280, 24);
            _TileOrder[30] = new GoToJail();
            _TileOrder[31] = new Basic("Pacific Avenue", 300, 26);
            _TileOrder[32] = new Basic("North Carolina Avenue", 300, 26);
            _TileOrder[33] = new CardSpace("Community Chest");
            _TileOrder[34] = new Basic("Pennsylvania Avenue", 320, 28);
            _TileOrder[35] = new Railroad("Short Line Railroad", 200, 25);
            _TileOrder[36] = new CardSpace("Chance");
            _TileOrder[37] = new Basic("Park Place", 350, 35);
            _TileOrder[38] = new FreeParking("Luxury Tax");   //LuxuryTax
            _TileOrder[39] = new Basic("Boardwalk", 400, 50);
        }
Exemplo n.º 5
0
 private void updateProperty(FreeParking p, Player player, TextBlock tb)
 {
     if (p.Name == "Income Tax")
     {
         tb.Foreground = Brushes.Red;
         if (player.Money / 10 > 200)
         {
             tb.Text = (player.Money / 10).ToString("c0");
         }
         else
         {
             tb.Text = "$200";
         }
     }
     else
     {
         tb.Foreground = Brushes.Red;
         tb.Text       = "$100";
     }
 }
Exemplo n.º 6
0
        private void UpdateBoard(Player player)
        {
            Property    p1  = (Property)GameLoop.getInstance().Gameboard.TileOrder[1];
            Property    p3  = (Property)GameLoop.getInstance().Gameboard.TileOrder[3];
            FreeParking p4  = (FreeParking)GameLoop.getInstance().Gameboard.TileOrder[4];
            Property    p5  = (Railroad)GameLoop.getInstance().Gameboard.TileOrder[5];
            Property    p6  = (Property)GameLoop.getInstance().Gameboard.TileOrder[6];
            Property    p8  = (Property)GameLoop.getInstance().Gameboard.TileOrder[8];
            Property    p9  = (Property)GameLoop.getInstance().Gameboard.TileOrder[9];
            Property    p11 = (Property)GameLoop.getInstance().Gameboard.TileOrder[11];
            Utility     p12 = (Utility)GameLoop.getInstance().Gameboard.TileOrder[12];
            Property    p13 = (Property)GameLoop.getInstance().Gameboard.TileOrder[13];
            Property    p14 = (Property)GameLoop.getInstance().Gameboard.TileOrder[14];
            Property    p15 = (Railroad)GameLoop.getInstance().Gameboard.TileOrder[15];
            Property    p16 = (Property)GameLoop.getInstance().Gameboard.TileOrder[16];
            Property    p18 = (Property)GameLoop.getInstance().Gameboard.TileOrder[18];
            Property    p19 = (Property)GameLoop.getInstance().Gameboard.TileOrder[19];
            Property    p21 = (Property)GameLoop.getInstance().Gameboard.TileOrder[21];
            Property    p23 = (Property)GameLoop.getInstance().Gameboard.TileOrder[23];
            Property    p24 = (Property)GameLoop.getInstance().Gameboard.TileOrder[24];
            Property    p25 = (Railroad)GameLoop.getInstance().Gameboard.TileOrder[25];
            Property    p26 = (Property)GameLoop.getInstance().Gameboard.TileOrder[26];
            Property    p27 = (Property)GameLoop.getInstance().Gameboard.TileOrder[27];
            Utility     p28 = (Utility)GameLoop.getInstance().Gameboard.TileOrder[28];
            Property    p29 = (Property)GameLoop.getInstance().Gameboard.TileOrder[29];
            Property    p31 = (Property)GameLoop.getInstance().Gameboard.TileOrder[31];
            Property    p32 = (Property)GameLoop.getInstance().Gameboard.TileOrder[32];
            Property    p34 = (Property)GameLoop.getInstance().Gameboard.TileOrder[34];
            Property    p35 = (Railroad)GameLoop.getInstance().Gameboard.TileOrder[35];
            Property    p37 = (Property)GameLoop.getInstance().Gameboard.TileOrder[37];
            FreeParking p38 = (FreeParking)GameLoop.getInstance().Gameboard.TileOrder[38];
            Property    p39 = (Property)GameLoop.getInstance().Gameboard.TileOrder[39];

            updateProperty(p1, player, tbValue1);
            updateProperty(p3, player, tbValue3);
            updateProperty(p4, player, tbValue4);
            updateProperty(p5, player, tbValue5);
            updateProperty(p6, player, tbValue6);
            updateProperty(p8, player, tbValue8);
            updateProperty(p9, player, tbValue9);
            updateProperty(p11, player, tbValue11);
            updateProperty(p12, player, tbValue12);
            updateProperty(p13, player, tbValue13);
            updateProperty(p14, player, tbValue14);
            updateProperty(p15, player, tbValue15);
            updateProperty(p16, player, tbValue16);
            updateProperty(p18, player, tbValue18);
            updateProperty(p19, player, tbValue19);
            updateProperty(p21, player, tbValue21);
            updateProperty(p23, player, tbValue23);
            updateProperty(p24, player, tbValue24);
            updateProperty(p25, player, tbValue25);
            updateProperty(p26, player, tbValue26);
            updateProperty(p27, player, tbValue27);
            updateProperty(p28, player, tbValue28);
            updateProperty(p29, player, tbValue29);
            updateProperty(p31, player, tbValue31);
            updateProperty(p32, player, tbValue32);
            updateProperty(p34, player, tbValue34);
            updateProperty(p35, player, tbValue35);
            updateProperty(p37, player, tbValue37);
            updateProperty(p38, player, tbValue38);
            updateProperty(p39, player, tbValue39);
        }