public void CheckPosition(MonopolyBoard board) { Space currentSpace = board.Spaces[this.CurrentIndex]; // board.AddPlayerToSpace(this); //if (currentSpace.SpaceType.Equals("Chance")) // this.Move(4, board); // Draw card //else if (currentSpace.SpaceType.Equals("CommunityChest")) // this.Move(2, board); //else if (currentSpace.SpaceType.Equals("Property")) //{ // this.Move(0, board); // this.PayMoney(currentSpace.RentPrice); //} //// Implement propery strategy? CheckIfBuy(); //else if (currentSpace.SpaceType.Equals("Tax")) // this.Move(0, board); //if (currentSpace.SpaceType.Equals("Go To Jail")) //{ // this.MoveIndex(10); // this.IsInJail = true; //} board.AddPlayerToSpace(this); }
public Byte GetPlayerIndexAtStartOfBoard(MonopolyBoard board) { Byte result = (Byte)(this.CurrentIndex - board.Length + this.SpacesToMove); return(result); }
public void Move(Byte spacesToMove, MonopolyBoard board) { this.CurrentIndex += spacesToMove; if (this.CurrentIndex >= board.Length) { this.CurrentIndex = GetPlayerIndexAtStartOfBoard(board); } this.CurrentSpace = board.Spaces[CurrentIndex]; Console.WriteLine("Current index:"); Console.WriteLine(this.CurrentIndex); }
public void MoveIndex(Byte index, MonopolyBoard board) { CurrentIndex = index; this.CurrentSpace = board.Spaces[CurrentIndex]; }