示例#1
0
 public PathGenerator(uint seed, GetHeight getHeight)
 {
     m_getHeight = getHeight;
     var fastRandom = new FastRandom(seed);
     m_cellNoise = new CellNoise2D(fastRandom.NextUInt());
     m_sources = new Dictionary<uint, PathGraphNode>();
     m_sinks = new Dictionary<uint, PathGraphNode>();
     m_general = new Dictionary<uint, PathGraphNode>();
     m_paths = new List<PathNodeList>();
 }
 public async void Initialize(uint seed)
 {
     Seed = seed;
     var random = new FastRandom(Seed);
     var settings = await MainEngine.GetEngineInstance().GeneralSettings;
     m_sealevel = settings.SeaLevel;
     m_mountainHeight = settings.MountainHeight - m_sealevel;
     var rescale = settings.BiomeSampleRescale;
     m_detailScale = settings.DetailScale;
     m_sinkHoleDepth = settings.SinkHoleDepth;
     m_biomeThickness = settings.BiomeThickness;
     m_elevation = new SimplexNoise2D(random.NextUInt());
     m_detail = new SimplexNoise2D(random.NextUInt());
     m_detail2 = new SimplexNoise2D(random.NextUInt());
     m_volume = new SimplexNoise3D(random.NextUInt());
     m_voroni = new CellNoise2D(random.NextUInt());
     m_populator = new StructureGenerator(random.NextUInt());
     m_riverGenerator = new PathGenerator(random.NextUInt(), GetHeight);
     m_riverGenerator.InitializePathSystem(0, 0, 256);
     m_biomeGenerator = new BiomeGeneratorCollection(random.NextUInt(), GetHeight, settings.Biomes, rescale, m_sealevel, m_mountainHeight);
     m_provinceGenerator = new ProvinceGeneratorCollection(random.NextUInt(), GetHeight, settings.Provinces, rescale, m_sealevel, m_mountainHeight);
     IsInitialized = true;
 }