Exemple #1
0
 public Terrain(Texture2D water, Texture2D landbase, Texture2D landheight1, Texture2D landheight2)
 {
     generator = new TerrainGenerator(water, landbase, landheight1, landheight2);
     Areas     = new List <Platform>();
     rand      = new Random();
     stone     = landheight1;
 }
        public Platform ConvertToPlat(List <string> Data, ref TerrainGenerator tg)
        {
            Platform platform = new Platform();

            int y = 0;
            int e = 0;

            for (int i = 0; i < Data.Count; i++)
            {
                e++;
                if (e > 79)
                {
                    e = 0;
                    if (y < 1700)
                    {
                        y = y + 50;
                    }
                }
                if (Data[i] == "Dirt")
                {
                    platform.Tiles.Add(new Block(tg.landbase, new Point(e * 50, y), Data[i]));
                }
                if (Data[i] == "Stone")
                {
                    platform.Tiles.Add(new Block(tg.water, new Point(e * 50, y), Data[i]));
                }
                if (Data[i] == "Bush")
                {
                    platform.Tiles.Add(new Block(tg.landheight1, new Point(e * 50, y), Data[i]));
                }
                if (Data[i] == "Water")
                {
                    platform.Tiles.Add(new Block(tg.landheight2, new Point(e * 50, y), Data[i]));
                }
            }
            return(platform);
        }