Beispiel #1
0
        public MainWindow()
        {
            const int depth = 5;
            const int sizeExp = 9;
            int side = (int)Math.Pow(2, sizeExp);

            m_size = new IntSize3(side, side, depth);
            m_terrain = new TerrainData(m_size);
            m_terrainGen = new DungeonTerrainGenerator(m_terrain, new Random(1));
            m_renderer = new Renderer(m_size);

            this.SliceBmpXY = m_renderer.SliceBmpXY;
            this.SliceBmpXZ = m_renderer.SliceBmpXZ;
            this.SliceBmpYZ = m_renderer.SliceBmpYZ;

            InitializeComponent();
        }
        void CreateTerrain()
        {
            var random = Helpers.Random;

            int side = MyMath.Pow2(MAP_SIZE);
            var size = new IntSize3(side, side, MAP_DEPTH);

            var terrain = new TerrainData(size);

            var tg = new DungeonTerrainGenerator(terrain, random);

            tg.Generate(1);

            TerrainHelpers.CreateSoil(terrain, 9999);
            TerrainHelpers.CreateGrass(terrain, random, 9999);
            TerrainHelpers.CreateTrees(terrain, random);

            m_rooms = tg.Rooms;
            m_terrainData = terrain;
        }
        void CreateTerrain(IntSize3 size)
        {
            var random = Helpers.Random;

            var terrain = new TerrainData(size);

            var tg = new DungeonTerrainGenerator(terrain, random);

            tg.Generate(1);

            TerrainHelpers.CreateSoil(terrain, 9999);
            TerrainHelpers.CreateVegetation(terrain, random, 9999);

            m_rooms = tg.Rooms;
            m_terrainData = terrain;
        }