示例#1
0
        public override void HandleInput()
        {
            int nbr;
            string choice = Console.ReadLine();
            City city = CurrentGame().GetCity();
            ArmyManager build = CurrentGame().GetCity().GetArmies();
            switch(choice){
                case "1" :
                    nbr = unitNumber();
                    city.SetGold(new Gold(city.GetGold().GetAmount()-nbr));
                    city.SetFood(new Food(city.GetFood().GetAmount()-10*nbr));
                    build.CreateArcherArmy(nbr);
                    break;
                case "2" :
                    nbr = unitNumber();
                    city.SetGold(new Gold(city.GetGold().GetAmount()-nbr));
                    city.SetFood(new Food(city.GetFood().GetAmount()-5*nbr));
                    build.CreateKnightsArmy(nbr);
                    break;
                case "3" :
                    nbr = unitNumber();
                    city.SetGold(new Gold(city.GetGold().GetAmount()-nbr*2));
                    city.SetFood(new Food(city.GetFood().GetAmount()-12*nbr));
                    build.CreateWizardsArmy(nbr);
                    break;
                case "4" : PopMenu();
                    break;

                default : this.Display();
                    break;

            }
        }
示例#2
0
 public void SetArmies(ArmyManager armies)
 {
     this.armies = armies;
 }
示例#3
0
 public City()
 {
     this.armies = new ArmyManager();
     this.gold   = new Gold();
     this.food   = new Food();
 }