public GameController() { this.wareHouse = new WareHouse(); this.army = new Army(this.WareHouse); this.soldiersFactory = new SoldiersFactory(); this.ammunitionFactory = new AmmunitionFactory(); this.missionFactory = new MissionFactory(); this.soldierController = new SoldierController(this.Army, this.WareHouse); this.MissionControllerField = new MissionController(this.Army, this.WareHouse); this.result = new StringBuilder(); this.output = new Output(this.Army, this.WareHouse, result); }
public void GiveInputToGameController(string input) { var data = input.Split(); if (data[0].Equals("Soldier")) { string type = string.Empty; string name = string.Empty; int age = 0; int experience = 0; double speed = 0d; double endurance = 0d; double motivation = 0; double maxWeight = 0d; if (data.Length == 3) { type = data[1]; name = data[2]; } else { type = data[1]; name = data[2]; age = int.Parse(data[3]); experience = int.Parse(data[4]); speed = double.Parse(data[5]); endurance = double.Parse(data[6]); motivation = double.Parse(data[7]); maxWeight = double.Parse(data[8]); } switch (type) { case "Ranker": var ranker = SoldiersFactory.GenerateRanker(name, age, experience, speed, endurance, motivation, maxWeight); AddSoldierToArmy(ranker, type); break; case "Corporal": var corporal = SoldiersFactory.GenerateCorporal(name, age, experience, speed, endurance, motivation, maxWeight); AddSoldierToArmy(corporal, type); break; case "Special-Force": var specialForce = SoldiersFactory.GenerateSpecialForce(name, age, experience, speed, endurance, motivation, maxWeight); AddSoldierToArmy(specialForce, type); break; case "Regenerate": SoldierController.TeamRegenerate(army, name); break; case "Vacation": SoldierController.TeamGoesOnVacation(army, name); break; case "Bonus": SoldierController.TeamGetBonus(army, name); break; } } else if (data[0].Equals("WearHouse")) { string name = data[1]; int number = int.Parse(data[2]); AddAmmunitions(AmmunitionFactory.CreateAmmunitions(name, number)); } else if (data[0].Equals("Mission")) { this.MissionControllerField.PerformMission(new Easy()); } }