Exemplo n.º 1
0
        private void PlaceBiomes()
        {
            int max    = 0;
            int center = 0;

            #region Mushroom
            MushroomBiome mushroomBiome;
            max = _rnd.Next(2, 4); //Get the max number of mushroom biomes
            for (int i = 0; i < max; i++)
            {
                //Get a random starting point for the biome:
                center = _validIndexes[_rnd.Next(0, _validIndexes.Length)];
                if (Scene._grid[center].BasicValue == BasicValues.MushroomBiome)
                {
                    max++;
                }
                mushroomBiome = new MushroomBiome(_rnd);
                mushroomBiome.SpawnBiome(center);
            }
            #endregion
            #region Crystal
            CrystalBiome crystalBiome;
            max = _rnd.Next(2, 4); //Get the max number of crystal biomes
            for (int i = 0; i < max; i++)
            {
                //Get a random starting point for the biome:
                center = _validIndexes[_rnd.Next(0, _validIndexes.Length)];
                if (Scene._grid[center].BasicValue == BasicValues.CrystalBiome || Scene._grid[center].BasicValue == BasicValues.MushroomBiome)
                {
                    max++;
                }
                else
                {
                    crystalBiome = new CrystalBiome(_rnd);
                    crystalBiome.SpawnBiome(center);
                }
            }
            #endregion
        }
 private void PlaceBiomes()
 {
     int max = 0;
     int center = 0;
     #region Mushroom
     MushroomBiome mushroomBiome;
     max = _rnd.Next(2, 4); //Get the max number of mushroom biomes
     for(int i = 0; i < max; i++)
     {
         //Get a random starting point for the biome:
         center = _validIndexes[_rnd.Next(0, _validIndexes.Length)];
         if (Scene._grid[center].BasicValue == BasicValues.MushroomBiome)
             max++;
         mushroomBiome = new MushroomBiome(_rnd);
         mushroomBiome.SpawnBiome(center);
     }
     #endregion
     #region Crystal
     CrystalBiome crystalBiome;
     max = _rnd.Next(2, 4); //Get the max number of crystal biomes
     for (int i = 0; i < max; i++)
     {
         //Get a random starting point for the biome:
         center = _validIndexes[_rnd.Next(0, _validIndexes.Length)];
         if (Scene._grid[center].BasicValue == BasicValues.CrystalBiome || Scene._grid[center].BasicValue == BasicValues.MushroomBiome)
             max++;
         else
         {
             crystalBiome = new CrystalBiome(_rnd);
             crystalBiome.SpawnBiome(center);
         }
     }
     #endregion
 }