public void setLocation(int location) { if (location >= Board.access().getSquares()) { location = (location - Board.access().getSquares()); if (playerPassGo != null) { this.playerPassGo(this, new EventArgs()); } } this.location = location; Property p = Board.access().getProperty(location); if (p.getName() == "Chance" || p.getName() == "Community Chest") { if (playerLandOnChance != null) { this.playerLandOnChance(this, new EventArgs()); } } if ("Go To Jail" == p.getName() && playerGoJail != null) { Console.WriteLine($@"{this.getName()}: You landed on 'Go To Jail' and will be sent to Jail!!! "); this.playerGoJail(this, new EventArgs()); } }
public void setLocation(int location) { //if set location is greater than number of squares then move back to beginning if (location >= Board.access().getSquares()) { location = (location - Board.access().getSquares()); //raise the pass go event if subscribers if (playerPassGo != null) { this.playerPassGo(this, new EventArgs()); } } this.location = location; Property p = Board.access().getProperty(location); if (p.getName() == "Chance" || p.getName() == "Community Chest") { if (playerLandOnChance != null) { this.playerLandOnChance(this, new EventArgs()); } } if ("Go To Jail" == p.getName() && playerGoJail != null) { Console.WriteLine($@"{this.getName()}: You landed on 'Go To Jail' and will be sent to Jail!!! "); this.playerGoJail(this, new EventArgs()); } //Add an if for Go To Casino if ("Go To Casino" == p.getName() && playerGoCasino != null) { Console.WriteLine($@"{this.getName()}: You landed on 'Go To Casino' and will be sent to SkyCity"); this.playerGoCasino(this, new EventArgs()); } }
public void setLocation(int location) { //if set location is greater than number of squares then move back to beginning if (location >= Board.access().getSquares()) { location = (location - Board.access().getSquares()); //raise the pass go event if subscribers if (playerPassGo != null) { this.playerPassGo(this, new EventArgs()); } //add 200 for passing go //suntao mode this function into Monopoly.playerPassGoHandler() //this.receive(200); } this.location = location; Property p = Board.access().getProperty(location); if (p.getName() == "Chance" || p.getName() == "Community Chest") { if (playerLandOnChance != null) { this.playerLandOnChance(this, new EventArgs()); } } if ("Go To Jail" == p.getName() && playerGoJail != null) { Console.WriteLine($@"{this.getName()}: You landed on 'Go To Jail' and will be sent to Jail!!! "); this.playerGoJail(this, new EventArgs()); } }
public void test_Construct() { Property theProp = new Property(); StringAssert.Contains("Property", theProp.getName()); Assert.IsTrue(theProp.getOwner() == Banker.access()); }