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; }
public PlaneChunkGenerator(BasicObjectsParams parameters, BasicObjectsMaterials materials) { _params = parameters; _materials = materials; }
public void Start() { Math.Noise.SimplexSeed(context.profile.terrain.settings.seed); _materials = new BasicObjectsMaterials(); var materialFactor = context.materialFactory; if (_materialDirt != null) { _materials.dirt = materialFactor.GetMaterial(_materialDirt.GetComponent <LiveBehaviour>().name); } if (_materialGrass != null) { _materials.grass = materialFactor.GetMaterial(_materialGrass.GetComponent <LiveBehaviour>().name); } if (_materialSand != null) { _materials.sand = materialFactor.GetMaterial(_materialSand.GetComponent <LiveBehaviour>().name); } if (_materialTree != null) { _materials.tree = materialFactor.GetMaterial(_materialTree.GetComponent <LiveBehaviour>().name); } if (_materialTreeLeaf != null) { _materials.treeLeaf = materialFactor.GetMaterial(_materialTreeLeaf.GetComponent <LiveBehaviour>().name); } if (_materialObsidian != null) { _materials.obsidian = materialFactor.GetMaterial(_materialObsidian.GetComponent <LiveBehaviour>().name); } if (_materialWater != null) { _materials.water = materialFactor.GetMaterial(_materialWater.GetComponent <LiveBehaviour>().name); } if (_materialCloud != null) { _materials.cloud = materialFactor.GetMaterial(_materialCloud.GetComponent <LiveBehaviour>().name); } if (_materialCloud != null) { _materials.soil = materialFactor.GetMaterial(_materialSoil.GetComponent <LiveBehaviour>().name); } _materials.flower = new VoxelMaterial[_materialFlower.Length]; for (int i = 0; i < _materialFlower.Length; i++) { _materials.flower[i] = materialFactor.GetMaterial(_materialFlower[i].GetComponent <LiveBehaviour>().name); } _materials.weed = new VoxelMaterial[_materialWeed.Length]; for (int i = 0; i < _materialWeed.Length; i++) { _materials.weed[i] = materialFactor.GetMaterial(_materialWeed[i].GetComponent <LiveBehaviour>().name); } _materials.trees = new VoxelMaterial[_materialTrees.Length]; for (int i = 0; i < _materialTrees.Length; i++) { _materials.trees[i] = materialFactor.GetMaterial(_materialTrees[i].GetComponent <LiveBehaviour>().name); } _biomeDatas = new BiomeData[biomeParams.Count]; var written = 0; foreach (var param in biomeParams) { var biomeData = new BiomeData(new BasicObjectsChunkGenerator(param.Value, _materials)); _biomeDatas[written++] = biomeData; } _biomeDatas[(int)BasicObjectBiomeType.Plane] = new BiomeData(new PlaneChunkGenerator(biomeParams["Plane"], _materials)); _biomeDatas[(int)BasicObjectBiomeType.Cloud] = new BiomeData(new CloudChunkGenerator(biomeParams["Cloud"], _materials)); }