示例#1
0
        public override void Start()
        {
            _factory = FindObjectOfType(typeof(HealerFactory)) as HealerFactory;
            if (_factory == null)
            {
                return;
            }

            base.Factory = this._factory;
            base.Start();
        }
示例#2
0
 public Bot(IOutput output, MonsterFactory monsterFactory,
            HealerFactory healerFactory,
            WeaponDealerFactory weaponDealerFactory,
            ClothesDealerFactory clothesDealerFactory, PersonageSettings settings) : base(output)
 {
     _monsterFactory       = monsterFactory;
     _healerFactory        = healerFactory;
     _weaponDealerFactory  = weaponDealerFactory;
     _clothesDealerFactory = clothesDealerFactory;
     _settings             = settings;
 }
示例#3
0
        public static void Main()
        {
            PlayerFactory archerFactory = new ArcherFactory();
            var           archerClient  = new Client(archerFactory);

            archerClient.Run();

            PlayerFactory healerFactory = new HealerFactory();
            var           healerClient  = new Client(healerFactory);

            healerClient.Run();

            Console.ReadKey();
        }
示例#4
0
文件: Game.cs 项目: sdmitriew/rpg
 public Game(MonsterFactory monsterFactory,
             HealerFactory healerFactory,
             WeaponDealerFactory weaponDealerFactory,
             ClothesDealerFactory clothesDealerFactory,
             BotFactory botFactory,
             Gamer gamer)
 {
     _gamer   = gamer;
     _actions = new Dictionary <ConsoleKey, Func <Personage> >
     {
         { ConsoleKey.W, monsterFactory.GetPersonage },
         { ConsoleKey.S, healerFactory.GetPersonage },
         { ConsoleKey.A, weaponDealerFactory.GetPersonage },
         { ConsoleKey.D, clothesDealerFactory.GetPersonage },
         { ConsoleKey.E, botFactory.GetPersonage }
     };
 }