예제 #1
0
        public void InitializeMonoliticRing2RegionsDatabase()
        {
            var habitatMap = new HabitatMapDbProxy(new HabitatMapDb(_configuration.HabitatDbInitializationInfo));

            _updatableContainer.AddOtherThreadProxy(habitatMap);

            _gameInitializationFields.SetField(habitatMap);

            var regionsDbGenerator = new Ring2RegionsDbGenerator(habitatMap,
                                                                 _configuration.Ring2RegionsDbGeneratorConfiguration(new Ring2AreaDistanceDatabase()),
                                                                 _gameInitializationFields.Retrive <RoadDatabaseProxy>());
            var regionsDatabase = regionsDbGenerator.GenerateDatabaseAsync(_configuration.Ring2GenerationArea).Result;

            _gameInitializationFields.SetField(regionsDatabase);
        }
예제 #2
0
        public void InitializeComplexRing2RegionsDatabase(Dictionary <int, Ring2RegionsDbGeneratorConfiguration> configurations)
        {
            var habitatMap = new HabitatMapDbProxy(new HabitatMapDb(_configuration.HabitatDbInitializationInfo));

            _updatableContainer.AddOtherThreadProxy(habitatMap);

            _gameInitializationFields.SetField(habitatMap);

            var monoliticDbs = configurations.ToDictionary(pair => pair.Key, pair =>
            {
                var regionsDbGenerator = new Ring2RegionsDbGenerator(habitatMap,
                                                                     pair.Value,
                                                                     _gameInitializationFields.Retrive <RoadDatabaseProxy>());
                return(regionsDbGenerator.GenerateDatabaseAsync(_configuration.Ring2GenerationArea).Result);
            });
            var regionsDatabase = new ComplexRing2RegionsDatabase(monoliticDbs);

            _gameInitializationFields.SetField(regionsDatabase);
        }