Exemplo n.º 1
0
 public Transport(string sName)
 {
     this.sName          = sName;
     this.dPrice         = 200;
     this.dMortgageValue = 100;
     this.dRent          = 50;
     this.owner          = Banker.access();
 }
Exemplo n.º 2
0
 public override bool availableForPurchase()
 {
     //if owned by bank then available
     if (this.owner == Banker.access())
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 3
0
 public void testSingleton()
 {
     try
     {
         //Access banker twice and tests that it is the same object
         Assert.AreSame(Banker.access(), Banker.access());
     }
     catch (NotImplementedException ex)
     {
         Console.WriteLine("A part of the program is yet to be implemented");
     }
 }
Exemplo n.º 4
0
 public override string landOn(ref Player player)
 {
     //Pay rent if needed
     if ((this.getOwner() != Banker.access()) && (this.getOwner() != player))
     {
         //pay rent
         this.payRent(ref player);
         return(string.Format("You rolled a total of {0}. So your rent is {0} x {1} = ${2}.", player.getLastMove(), Utility.rentMultiplier, (player.getLastMove() * Utility.rentMultiplier)));
     }
     else
     {
         return(base.landOn(ref player));
     }
 }
Exemplo n.º 5
0
 public override string landOn(ref Player player)
 {
     //Pay rent if needed
     if ((this.getOwner() != Banker.access()) && (this.getOwner() != player))
     {
         //pay rent
         this.payRent(ref player);
         return(base.landOn(ref player) + string.Format("Rent has been paid for {0} of ${1} to {2}.", this.getName(), this.getRent(), this.getOwner().getName()));
     }
     else
     {
         return(base.landOn(ref player));
     }
 }
Exemplo n.º 6
0
        public override void checkBankrupt()
        {
            if (this.getBalance() <= 0)
            {
                //raise the player bankrupt event if there are subscribers
                if (playerBankrupt != null)
                {
                    this.playerBankrupt(this, new EventArgs());
                }

                //return all the properties to the bank
                Banker b = Banker.access();
                foreach (Property p in this.getPropertiesOwnedFromBoard())
                {
                    p.setOwner(ref b);
                }
                //set isInactive to true
                this.isInactive = true;
            }
        }
Exemplo n.º 7
0
 public Utility(String name)
 {
     this.sName = name;
     this.owner = Banker.access();
 }
Exemplo n.º 8
0
 public Property(string sName)
 {
     this.sName = sName;
     this.owner = Banker.access();
 }