Exemple #1
0
        public IMap CreateMap(Structure structure, int seed, MapSettings settings)
        {
            var map = new Map(structure.Width, structure.Height);

            new FormPolygons(structure, new NoiseLineGenerator()).Build(map, settings);

            new CalculateDistanceFromEdgeBuilderComponent().Build(map, settings);

            new PerlinNoiseLandGenerator(seed, new PerlinNoiseGeneratorOld()).Build(map, settings);

            new DefineOcean().Build(map, settings);

            new AssignCoastBuilderComponent().Build(map, settings);

            new StructureLakes().Build(map, settings);

            new PerlinNoiseElevation(new PerlinNoiseGeneratorOld()).Build(map, settings);
            //new DistanceFromWaterElevation(new PerlinNoiseGenerator()).Build(map, settings);

            new AddRiversBuilderComponent(new CommonAddRiverStrategy()).Build(map, settings);

            new MoistureGenerator().Build(map, settings);

            new SetTerranTypeFromSite().Build(map, settings);

            return map;
        }
        public IMap CreateMap(Structure structure, int seed, MapSettings settings)
        {
            var map = new Map(structure.Width, structure.Height);

            var report = new StringBuilder();
            var stopwatch = new Stopwatch();

            foreach (var component in m_ComponentsRegistry)
            {
                stopwatch.Reset();
                stopwatch.Start();
                component.Build(map, settings);
                stopwatch.Stop();
                report.AppendLine(string.Format("{0}: {1} ms", component.GetType().Name, stopwatch.ElapsedMilliseconds));
            }

            map.CreationReport = report.ToString();

            return map;
        }
 public FormPolygons(Structure structure, INoiseLineGenerator noiseLineGenerator)
 {
     m_Structure = structure;
     m_NoiseLineGenerator = noiseLineGenerator;
 }
        private void CreateNewStructure()
        {
            m_Structure = new Structure(MaxWidth, MaxHeight);

            //var mapFactory = new MapFactory(m_Structure);
            //m_Map = mapFactory.CreateMap((int)numericUpDownSeed.Value, m_DefaultSettings);

            //m_Structure.StructureChanged += OnStrucureChanged;
        }