Exemplo n.º 1
0
        public Game(IMonsterFactory factory)
        {
            gamer = new Hero(); // герой, за которого играем

            //Список комнат в локации
            Room[] rooms = new Room[]
            {
                new Room(),
                new Room(),
                new Room()
            };

            //Список сокровищ в локации
            Treasure[] treasures = new Treasure[]
            {
                new Treasure(),
                new Treasure(),
                new Treasure()
            };

            IMonster[] monsters = new IMonster[50]; // Список монстров в локации

            for (int i = 0; i < monsters.Length; i++)
            {
                monsters[i] = factory.Create(); // задаем тип монстра
            }

            location = new Dangeon(monsters, rooms, treasures); // инициализация игровой локации
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            IMonsterFactory[] lvls = new IMonsterFactory[]
            {
                new EasyLevelMonsterFactory(),
                new MiddleLevelMonsterFactory(),
                new HardLevelMonsterFactory()
            };

            Console.WriteLine("Выберите уровень сложности и введите его номер.");

            // Выведем все уровни сложности пользователю
            for (int i = 0; i < lvls.Length; i++)
            {
                Console.WriteLine($"{i+1}.{lvls[i].ToString()}");
            }

            int lvlNumber = Convert.ToInt32(Console.ReadLine()) - 1;

            if (lvlNumber > -1 && lvlNumber < lvls.Length)
            {
                Game game = new Game(lvls[lvlNumber]); // создаем игру
                game.StartGame();
            }
            else
            {
                Console.WriteLine("Указанный уровень отсутствует.");
            }

            Console.ReadKey(); // Задержка экрана.
        }
Exemplo n.º 3
0
 /// <summary>
 /// Creates a new <see cref="MapFactory"/> instance.
 /// </summary>
 /// <param name="logger"></param>
 /// <param name="serviceProvider"></param>
 /// <param name="npcFactory"></param>
 public MapFactory(ILogger <MapFactory> logger, IServiceProvider serviceProvider, INpcFactory npcFactory, IItemFactory itemFactory, IMonsterFactory monsterFactory)
 {
     _logger          = logger;
     _serviceProvider = serviceProvider;
     _npcFactory      = npcFactory;
     _itemFactory     = itemFactory;
     _monsterFactory  = monsterFactory;
 }
Exemplo n.º 4
0
 public StoryMaker(IRoomFactory roomFactory,
                   IMonsterFactory monsterFactory,
                   ILootFactory lootFactory)
 {
     _roomFactory    = roomFactory;
     _monsterFactory = monsterFactory;
     _lootFactory    = lootFactory;
 }
Exemplo n.º 5
0
 public CreateMonsterInteractor(
     IMonsterRepository monsterRepository,
     IMonsterFactory monsterFactory
     )
 {
     _monsterRepository = monsterRepository;
     _monsterFactory    = monsterFactory;
 }
Exemplo n.º 6
0
 public static IMonsterFactory Instance(IList <IMonsterType> monsterType = null)
 {
     if (instance == null)
     {
         instance = new MonsterFactory(monsterType);
     }
     return(instance);
 }
Exemplo n.º 7
0
        public static IMonsterFactory Instance()
        {
            if (instance == null)
            {
                instance = new MonsterFactory();
            }

            return(instance);
        }
Exemplo n.º 8
0
 public MonsterService(IMonsterRepository monsterRepository, ISlackWebApi slack, IUserService userService, IInventoryRepository inventoryRepository, IRandomService randomService, IMonsterFactory monsterFactory, IChannelRepository channelRepository)
 {
     _monsterRepository   = monsterRepository;
     _slack               = slack;
     _userService         = userService;
     _inventoryRepository = inventoryRepository;
     _randomService       = randomService;
     _monsterFactory      = monsterFactory;
     _channelRepository   = channelRepository;
 }
Exemplo n.º 9
0
 public CombatEngine(GameWorld gameWorld, IMonsterFactory monsterFactory, ICombatantSelector combantSelector, IDice dice)
 {
     _gameWorld = gameWorld;
     _combantSelector = combantSelector;
     _dice = dice;
     _combatContext = new CombatContext();
     _combatContext.Player = _gameWorld.Player;
     _combatContext.Monster = monsterFactory.CreateMonster(_gameWorld, _combatContext);
     _combatContext.Player.HasFledCombat = false;
     _combatContext.Monster.HasFledCombat = false;
 }
 public BatchSpaceObjectFactory(
     IRandomGenerator randomGenerator,
     IMonsterFactory monsterFactory,
     IPlanetFactory planetFactory,
     int probPlanet)
 {
     this.randomGenerator = randomGenerator;
     this.monsterFactory  = monsterFactory;
     this.planetFactory   = planetFactory;
     this.probPlanet      = probPlanet;
 }
Exemplo n.º 11
0
        public MonsterGroup(TimeSpan spawnTime, MonsterType monsterType, int count, IMonsterFactory factory)
        {
            this.SpawnTime   = spawnTime;
            this.MonsterType = monsterType;
            this.Count       = count;
            this.Finished    = false;

            this.factory = factory;
            this.timeElapsedSinceLastAddedGameObject = new TimeSpan();
            this.monsters   = this.CreateMonsters(factory);
            this.enumerator = this.monsters.GetEnumerator();
        }
Exemplo n.º 12
0
        public MonsterWave(TimeSpan spawnTime, IMonsterFactory factory)
        {
            this.SpawnTime = spawnTime;
            this.Finished  = false;
            this.Level     = 1;
            this.Groups    = this.CreateGroups();

            this.factory = factory;
            this.timeElapsedSinceLastGroupFinished = new TimeSpan();
            this.enumerator = this.Groups.GetEnumerator();
            this.enumerator.MoveNext();
        }
Exemplo n.º 13
0
        public MonsterManualViewModel(IMonsterFactory monsterFactory, IMonsterApi monsterApi)
        {
            _monsterFactory = monsterFactory;
            _monsterApi     = monsterApi;

            Messenger.Default.Register <MessageWindowResponse>(this, "ReloadMonster", msg =>
            {
                if (msg.Response)
                {
                    GetMonsterDetails();
                }
            });

            GetMonsters();
        }
Exemplo n.º 14
0
        public StoryElements(IMonsterFactory monsterFactory, ILootFactory lootFactory, IRoomFactory roomFactory)
        {
            if (monsterFactory == null)
            {
                throw new ArgumentNullException("A monsterFactory must be supplied");
            }

            if (lootFactory == null)
            {
                throw new ArgumentNullException("A lootFactory must be supplied");
            }

            if (roomFactory == null)
            {
                throw new ArgumentNullException("A roomFactory must be supplied");
            }

            this.monsterFactory = monsterFactory;
            this.lootFactory    = lootFactory;
            this.roomFactory    = roomFactory;
        }
 public Graveyard(IMonsterFactory factory)
 {
     _monsterFactory = factory;
 }
Exemplo n.º 16
0
 public MonsterService(IWebDriver webDriver, IMonsterFactory monsterFactory)
 {
     _monsterFactory = monsterFactory;
     _webDriver      = webDriver;
 }
Exemplo n.º 17
0
 /// <summary>
 ///  Метод - конструктор, где создаются объекты при помощи фабрики
 /// </summary>
 public Monster(IMonsterFactory factory)
 {
     _weapon   = factory.CreateWeapon();
     _movement = factory.CreateMovement();
 }
 public HallwayFactory(IMonsterFactory iMonsterFactory)
 {
     _iMonsterFactory = iMonsterFactory;
 }
Exemplo n.º 19
0
 public InitialMonsterWave(TimeSpan spawnTime, IMonsterFactory factory)
     : base(spawnTime, factory)
 {
 }
Exemplo n.º 20
0
 public MonsterRepository(DougContext db, IMonsterFactory monsterFactory)
 {
     _db             = db;
     _monsterFactory = monsterFactory;
 }
Exemplo n.º 21
0
 protected virtual IEnumerable <IMonster> CreateMonsters(IMonsterFactory factory)
 {
     return(Enumerable.Repeat <MonsterType>(this.MonsterType, this.Count).Select(type => factory.CreateMonster(type)));
 }
Exemplo n.º 22
0
 public void LoadMonster(IMonsterFactory monsterFactory)
 {
     Monster        = monsterFactory.CreateMonster(MonsterId);
     Monster.Health = Health;
 }
Exemplo n.º 23
0
 public AddMonsterCommand(IRepository <IMonster> monsterRepository, IMonsterFactory monsterFactory)
 {
     this.monsterRepository = monsterRepository;
     this.monsterFactory    = monsterFactory;
 }
 public MonsterFactoryTest()
 {
     _monsterFactory = new MonsterFactory();
 }
Exemplo n.º 25
0
 public AddMonsterCommand(IRepository <IMonster> repository, IMonsterFactory factory)
 {
     this.repository = repository;
     this.factory    = factory;
 }
Exemplo n.º 26
0
        /// <summary>
        /// Creates a new <see cref="CreateMonsterChatCommand"/> instance.
        /// </summary>
        /// <param name="logger">Logger.</param>
        /// <param name="monsterFactory">Monster factory.</param>

        public CreateMonsterChatCommand(ILogger <CreateMonsterChatCommand> logger, IMapManager mapManager, IMonsterFactory monsterFactory)
        {
            _logger         = logger;
            _monsterFactory = monsterFactory;
        }