Esempio n. 1
0
        private async Task GenerateStaticObjectsAsync(
            ISector sector,
            ISectorSubScheme sectorScheme,
            ISectorNode sectorNode)
        {
            var resourceDepositData = _resourceMaterializationMap.GetDepositData(sectorNode);
            var context             = new StaticObjectGenerationContext(sector, sectorScheme, resourceDepositData);

            await _staticObstaclesGenerator.CreateAsync(context).ConfigureAwait(false);
        }
Esempio n. 2
0
        /// <summary>
        /// Создаёт экземпляр сектора подземелий с указанными параметрами.
        /// </summary>
        /// <param name="sectorNode"> Схема генерации сектора. </param>
        /// <returns> Возвращает экземпляр сектора. </returns>
        public async Task <ISector> GenerateAsync(ISectorNode sectorNode)
        {
            if (sectorNode is null)
            {
                throw new ArgumentNullException(nameof(sectorNode));
            }

            var mapFactory = _mapFactorySelector.GetMapFactory(sectorNode);

            var transitions = MapFactoryHelper.CreateTransitions(sectorNode);

            var sectorFactoryOptions = new SectorMapFactoryOptions(sectorNode.SectorScheme.MapGeneratorOptions, transitions);

            var map = await mapFactory.CreateAsync(sectorFactoryOptions).ConfigureAwait(false);

            var locationScheme = sectorNode.Biome.LocationScheme;

            var sector = _sectorFactory.Create(map, locationScheme);

            DefineDiseases(sector);

            var gameObjectRegions = map.Regions.Where(x => !x.IsStart).ToArray();

            var sectorScheme = sectorNode.SectorScheme;

            var resourceDepositData = _resourceMaterializationMap.GetDepositData(sectorNode);

            var staticObjectgenerationContext = new StaticObjectGenerationContext(sector, sectorScheme, resourceDepositData);

            await _staticObstaclesGenerator.CreateAsync(staticObjectgenerationContext).ConfigureAwait(false);

            var monsterRegions = gameObjectRegions.ToArray();

            _monsterGenerator.CreateMonsters(sector,
                                             _botPlayer,
                                             monsterRegions,
                                             sectorScheme);

            return(sector);
        }