private void AddTrees() { // Add a child object to the chunk to store trees in. // And to hold the ChunkTreesGenerator component GameObject TreeHolderObj = new GameObject(); TreeHolderObj.name = "TreesAssets"; TreeHolderObj.transform.parent = this.Terrain.transform; // Add reference to the ChunkTreeGenerator component to this terrainchunk // so other components can access it easily TreesComponent = TreeHolderObj.AddComponent <ChunkTreeGenerator>(); TreesComponent.ParentChunk = this; TreesComponent.Generate(); }
private void Awake() { if (ChunkTreeGenerator.AssetPrefabs == null) { ChunkTreeGenerator.LoadPrefabs(); } this.GameController = GameController.GetSharedInstance(); this.PlacedAssets = new List <GameObject>(); this.sampler = new PoissonDiscSampler(); this.sparseMask = new Perlin() { OctaveCount = 8, Frequency = 1.7, Persistence = 0.6 }; }