Exemplo n.º 1
0
        public Terrain2D(DwarfGame game)
        {
            Bloom = new BloomComponent(game)
            {
                Settings = BloomSettings.PresetSettings[0]
            };
            CaveScale     = 0.08f;
            HeightScale   = 0.01f;
            CaveThreshold = 0.5f;
            LavaHeight    = 0.6f;
            TileSize      = 64;
            Noise         = new Perlin(new Random().Next());
            Texture2D tiles = TextureManager.GetTexture(ContentPaths.Terrain.terrain_tiles);

            Substrate = new TerrainElement
            {
                Image = new ImageFrame(tiles, 32, 3, 1),
                Name  = "Rock"
            };

            Soil = new TerrainElement
            {
                Image = new ImageFrame(tiles, 32, 2, 0),
                Name  = "Dirt"
            };


            Grass = new TerrainElement
            {
                Image = new ImageFrame(tiles, 32, 3, 0),
                Name  = "Grass"
            };


            Lava = new TerrainElement
            {
                Image = new ImageFrame(tiles, 32, 0, 7),
                Name  = "Lava"
            };

            Cave = new TerrainElement
            {
                Image = new ImageFrame(tiles, 32, 1, 0),
                Name  = "Rock2"
            };



            Ores = new List <TerrainElement>
            {
                new TerrainElement
                {
                    Image          = new ImageFrame(tiles, 32, 2, 11),
                    Name           = "Gold",
                    SpawnScale     = 0.05f,
                    SpawnThreshold = 0.9f
                },
                new TerrainElement
                {
                    Image          = new ImageFrame(tiles, 32, 3, 11),
                    Name           = "Mana",
                    SpawnScale     = 0.04f,
                    SpawnThreshold = 0.9f
                }
            };

            Bloom.Initialize();
        }