예제 #1
0
        public MountainsGenerator(MacroMap macroMap, IEnumerable <Cell> zoneCells, int id, BiomeSettings biome, TriRunner settings) : base(macroMap, zoneCells, id, biome, settings)
        {
            Assert.IsTrue(biome.Type == BiomeType.Mountain);

            _microReliefNoise = new FastNoise(_random.Seed);
            _microReliefNoise.SetFrequency(1);
        }
예제 #2
0
        public CavesGenerator(MacroMap macroMap, IEnumerable <Cell> zoneCells, int id, BiomeSettings biome, TriRunner settings) : base(macroMap, zoneCells, id, biome, settings)
        {
            Assert.IsTrue(biome.Type == BiomeType.Caves);

            _cavesNoise = new FastNoise(_random.Seed);
            _cavesNoise.SetFrequency(0.1);
        }
예제 #3
0
        public DesertGenerator(MacroMap macroMap, IEnumerable <Cell> zoneCells, int id, BiomeSettings biome, TriRunner settings) : base(macroMap, zoneCells, id, biome, settings)
        {
            Assert.IsTrue(biome.Type == BiomeType.Desert);

            _dunesNoise = new FastNoise(_random.Seed);
            _dunesNoise.SetFrequency(1);

            _hillsOrientation = _random.Range(0, 180f);
            _stoneBlock       = settings.AllBlocks.First(b => b.Block == BlockType.Stone);
            _globalZoneHeight = _random.Range(0, 10);
        }
예제 #4
0
        public void Render(MacroMap map, TriRunner renderSettings)
        {
            var mesh = _mesher.CreateMacroMesh(map, renderSettings.MacroCellInfluenceVisualization);

            var meshGO = new GameObject("MacroMap");
            var filter = meshGO.AddComponent <MeshFilter>();

            filter.mesh = mesh;
            var renderer = meshGO.AddComponent <MeshRenderer>();

            renderer.sharedMaterial = _vertexColor;
            meshGO.transform.SetParent(GetMeshRoot());
        }
예제 #5
0
        public BaseZoneGenerator(MacroMap macroMap, IEnumerable <Cell> zoneCells, int id, BiomeSettings biome, TriRunner settings)
        {
            _macroMap = macroMap;
            _settings = settings;
            _random   = new Random(unchecked (settings.Seed + id));

            _microReliefNoise = new FastNoise(_random.Seed);
            _microReliefNoise.SetFrequency(1);

            _resourcesNoise = new FastNoise(_random.Seed);
            _resourcesNoise.SetFrequency(0.05);

            Assert.IsTrue(zoneCells.All(c => c.ZoneId == id));

            Zone = new Macro.Zone(_macroMap, _macroMap.GetSubmesh(zoneCells), id, biome, settings);
        }
예제 #6
0
        public MicroMap(MacroMap macromap, TriRunner settings)
        {
            Bounds = (Bounds2i)macromap.Bounds;

            _macromap = macromap;
            _settings = settings;

            Cells = new Cell[macromap.Cells.Count];
            for (var i = 0; i < macromap.Cells.Count; i++)
            {
                var macroCell = macromap.Cells[i];
                var microCell = new Cell(macroCell, this);
                Cells[i] = microCell;
            }

            _heightMap = new Heights[Bounds.Size.X + 1, Bounds.Size.Z + 1];
            _blocks    = new Blocks[Bounds.Size.X, Bounds.Size.Z];

            Debug.LogFormat("Generated micromap {0} x {1} = {2} blocks", Bounds.Size.X, Bounds.Size.Z, Bounds.Size.X * Bounds.Size.Z);
        }
예제 #7
0
 public TestZoneGenerator(MacroMap macroMap, IEnumerable <Cell> zoneCells, int id, BiomeSettings biome, TriRunner settings) : base(macroMap, zoneCells, id, biome, settings)
 {
     Assert.IsTrue(biome.Type >= BiomeType.TestBegin && biome.Type <= BiomeType.TestEnd);
     _generator = new FastNoise(unchecked (settings.Seed + id));
     _generator.SetFrequency(1);
 }