Example #1
0
 public BiomeData buildSandyland(float noise)
 {
     if (noise > 0.497)
     {
         var parameters = new BasicObjectsParams {
             layer = BasicObjectBiomeType.Sandyland, isGenSand = true, isGenFlower = false, isGenTree = false, thresholdSand = (0.5f - noise) * 1000.0f
         };
         return(new BiomeData(new BasicObjectsChunkGenerator(parameters, _materials)));
     }
     else
     {
         var parameters = new BasicObjectsParams {
             layer = BasicObjectBiomeType.Sandyland, isGenSand = true, isGenFlower = false, isGenTree = false, isGenGrass = false
         };
         return(new BiomeData(new BasicObjectsChunkGenerator(parameters, _materials)));
     }
 }
Example #2
0
 public BiomeData buildGrassland(float noise)
 {
     if (noise > 0.485f)
     {
         var parameters = new BasicObjectsParams {
             layer = BasicObjectBiomeType.Sandyland, isGenSand = true, thresholdSand = (0.49f - 0.485f) * 50.0f
         };
         return(new BiomeData(new BasicObjectsChunkGenerator(parameters, _materials)));
     }
     else
     {
         var parameters = new BasicObjectsParams {
             layer = BasicObjectBiomeType.Grassland,
         };
         return(new BiomeData(new BasicObjectsChunkGenerator(parameters, _materials)));
     }
 }
Example #3
0
        public BiomeData buildForest(float noise)
        {
            var noiseParams = new NoiseParams()
            {
                octaves     = 6,
                loopX       = 1.0f,
                loopZ       = 1.0f,
                persistence = 0.5f,
                lacunarity  = 2.0f,
                threshold   = 0.87f - (0.52f - noise) * 10.0f,
            };

            var parameters = new BasicObjectsParams {
                layer = BasicObjectBiomeType.Forest, tree = noiseParams
            };

            return(new BiomeData(new BasicObjectsChunkGenerator(parameters, _materials)));
        }
        public BasicObjectsChunkGenerator(BasicObjectsParams parameters, BasicObjectsMaterials materials)
        {
            if (parameters.isGenTree && materials.tree == null)
            {
                UnityEngine.Debug.LogError("Please drag a Tree into Hierarchy View.");
            }
            if (parameters.isGenTree && materials.treeLeaf == null)
            {
                UnityEngine.Debug.LogError("Please drag a TreeLeaf into Hierarchy View.");
            }
            if (parameters.isGenGrass && materials.sand == null)
            {
                UnityEngine.Debug.LogError("Please drag a Sand into Hierarchy View.");
            }
            if (parameters.isGenFlower && materials.flower == null)
            {
                UnityEngine.Debug.LogError("Please drag a Flower into Hierarchy View.");
            }
            if (parameters.isGenWeed && materials.weed == null)
            {
                UnityEngine.Debug.LogError("Please drag a Weed into Hierarchy View.");
            }
            if (parameters.isGenObsidian && materials.obsidian == null)
            {
                UnityEngine.Debug.LogError("Please drag a Obsidian into Hierarchy View.");
            }
            if (parameters.isGenWater && materials.water == null)
            {
                UnityEngine.Debug.LogError("Please drag a Water into Hierarchy View.");
            }
            if (parameters.isGenCloud && materials.cloud == null)
            {
                UnityEngine.Debug.LogError("Please drag a Cloud into Hierarchy View.");
            }
            if (parameters.isGenSoil && materials.soil == null)
            {
                UnityEngine.Debug.LogError("Please drag a Soil into Hierarchy View.");
            }

            _params    = parameters;
            _materials = materials;
        }
Example #5
0
 public PlaneChunkGenerator(BasicObjectsParams parameters, BasicObjectsMaterials materials)
 {
     _params    = parameters;
     _materials = materials;
 }