Exemplo n.º 1
0
        public static void War(IBarrack barrack)
        {
            IArcher[]    archers   = new IArcher[2];
            ISwordsman[] swordsmen = new ISwordsman[3];
            IRider[]     riders    = new IRider[2];

            for (int i = 0; i < 2; i++)
            {
                archers[i] = barrack.CreateArcher();
                archers[i].Attack();
            }
            for (int i = 0; i < 3; i++)
            {
                swordsmen[i] = barrack.CreateSwordman();
                swordsmen[i].Attack();
            }
            for (int i = 0; i < 2; i++)
            {
                riders[i] = barrack.CreateRider();
                riders[i].Attack();
            }
        }
Exemplo n.º 2
0
 public ArmyCommandController(IInfantry infantryService, ICavalry cavalryService, IArcher archerService)
 {
     this.InfantryService = infantryService;
     this.CavalryService  = cavalryService;
     this.ArcherService   = archerService;
 }
Exemplo n.º 3
0
 public ArcherAdapter(IArcher archer)
 {
     _archer = archer;
 }