protected void InstantiateChunk(Vector3 pos) { GameObject chunkObj = Instantiate(new GameObject(), pos, Quaternion.identity, transform); MangoFogChunk newFogChunk = chunkObj.AddComponent <MangoFogChunk>(); MangoFogRenderer newFogRenderer = chunkObj.AddComponent <MangoFogRenderer>(); //gives the new chunk a reference to its renderer newFogChunk.SetRenderer(newFogRenderer); //inits the chunk newFogChunk.Init(); newFogChunk.gameObject.SetActive(true); //set the chunk id newFogChunk.SetChunkID(chunksCreated); //add the chunk to the dictionary chunks.Add(pos, newFogChunk); chunkObj.gameObject.name = "Mango Fog Chunk " + chunksCreated; chunksCreated += 1; }
public void SetRenderer(MangoFogRenderer renderer) { fogRenderer = renderer; }