示例#1
0
 public override void Initialize()
 {
     House = new House(HouseAveragePrice, HouseName, "Images/AlertIcons/House");
 }
示例#2
0
        public void CashTest()
        {
            const int cash = 12312;
            Vector2 location = Vector2.Zero;

            Player player = new Player();
            player.Initialize();
            player.Cash += cash;
            Transport worthlessCar = new Transport(TransportType.Car, String.Empty, 100, null, null, 0);
            Assert.AreEqual(AssetResponse.AddedSuccessfully, player.Accept(worthlessCar));

            Asset asset1 = new House(15212, "testing house", String.Empty);
            Asset asset2 = new Partner();

            Assert.AreEqual(AssetResponse.AddedSuccessfully, player.Accept(asset1));
            Assert.AreEqual(AssetResponse.AddedSuccessfully, player.Accept(asset2));

            int expected = cash;
            int actual;
            player.Cash = expected;
            actual = player.Cash;
            Assert.AreEqual(expected, actual);
        }
示例#3
0
        public void TotalValueTest()
        {
            int playerCash = RandomHelper.Next(0, 500000);
            int houseValue = RandomHelper.Next(0, 500000);
            int peopleValue = Constants.GameRules.TransportableValue;
            int carValue = RandomHelper.Next(0, 500000);

            Player player = new Player();
            player.Initialize();
            player.Cash += playerCash;

            Transport car = new Transport(TransportType.Car, String.Empty, 100, null, null, carValue);
            Assert.AreEqual(AssetResponse.AddedSuccessfully, player.Accept(car));
            Assert.AreEqual(playerCash + carValue, player.TotalValue);

            Assert.AreEqual(playerCash, player.Cash);

            Asset asset1 = new House(houseValue, "testing house", String.Empty);
            Asset asset2 = new Partner();

            // make sure the player can afford the house
            player.Cash += asset1.Value;
            Assert.AreEqual(playerCash + houseValue, player.Cash);
            Assert.AreEqual(AssetResponse.AddedSuccessfully, player.Accept(asset1));
            Assert.AreEqual(playerCash + houseValue + carValue, player.TotalValue);

            Assert.AreEqual(AssetResponse.AddedSuccessfully, player.Accept(asset2));

            Assert.AreEqual( playerCash + houseValue + peopleValue + carValue, player.TotalValue);
        }
示例#4
0
 private void SellHouse(Player player, House house, Window window)
 {
     CloseMenuWindow();
     var alertString = String.Format("You just sold your house {0} for a price of ${1:N0}" +
                                     "\n\nYou made a profit of ${2:N0}",
                                     house.Name, house.Value, house.Value - house.PlayerBuyingValue);
     var alert = new Alert(ControlManager.Manager, alertString, "House Sold");
     ControlManager.Add(alert);
     player.Remove(house);
     alert.BringToFront();
     window.Enabled = false;
     alert.Closed += (sender, args) => window.Enabled = true;
 }