public Board(string filename) { gameBoard = new Case[40]; StreamReader sr = new StreamReader(filename); string stock = sr.ReadLine(); string[] stock2 = new string[11]; int[] rents = new int[6]; for (int i = 0; i < 40; i++) { stock = sr.ReadLine(); stock2 = stock.Split(';'); if (stock2[1] == "Ville") { for (int j = 0; j < 6; j++) { rents[j] = int.Parse(stock2[j + 5]); } gameBoard[i] = new CityCase(stock2[0], stock2[2], int.Parse(stock2[3]), int.Parse(stock2[4]), rents); } else { if (!stock2[0].Equals("Parc Gratuit")) { gameBoard[i] = new ActionCase(stock2[0], stock2[2]); } else { gameBoard[i] = new FreeParking(stock2[0], stock2[2]); } } } this.dices = new Dice[2]; this.dices[0] = new Dice(); this.dices[1] = new Dice(); this.activePlayer = 0; this.state = ""; this.myView = new GameView(this); this.myController = new GameController(this); this.players = new List <Player>(); }
public void LandOnAction(Player activePlayer, ActionCase activeCase) { Console.WriteLine("You landed on " + activeCase.Name); switch (activeCase.Action) { case "Vous remportez 100M": Console.WriteLine(activeCase.Action); ChangeBalance(100, activePlayer); break; case "Payer 200M": Console.WriteLine(activeCase.Action); ChangeBalance(-200, activePlayer); break; case "Payer 50M": Console.WriteLine(activeCase.Action); ChangeBalance(-50, activePlayer); break; case "Rien": Console.WriteLine("C'est une simple visite"); break; case "Payer 100M": Console.WriteLine(activeCase.Action); ChangeBalance(-100, activePlayer); break; case "Vous remportez 70M": Console.WriteLine(activeCase.Action); ChangeBalance(70, activePlayer); break; case "Allez en prison": Console.WriteLine(activeCase.Action); activePlayer.Position = 10; activePlayer.IsLocked = true; break; case "Vous remportez 50M": Console.WriteLine(activeCase.Action); ChangeBalance(50, activePlayer); break; case "Payer 30M": Console.WriteLine(activeCase.Action); ChangeBalance(-30, activePlayer); break; case "Recevez 400M": Console.WriteLine(activeCase.Action); ChangeBalance(400, activePlayer); break; case "Vous remportez le total des taxes accumulees": Console.WriteLine(activeCase.Action + " soit " + ((FreeParking)myBoard.GameBoard[20]).TotalTaxes); ChangeBalance(((FreeParking)myBoard.GameBoard[20]).TotalTaxes, activePlayer); ((FreeParking)myBoard.GameBoard[20]).TotalTaxes = 0; break; } NextAction(); }