void DrawDensityFuncChooser(Rect r, ChunkToGenerate chunk) { //Get all density functions var assem = Assembly.GetAssembly(typeof(IDensityFunc)); var allPossFuncTypes = assem.GetTypes().Where(t => typeof(IDensityFunc).IsAssignableFrom(t) && t != typeof(IDensityFunc)); //generic menu shown as dropdown GenericMenu menu = new GenericMenu(); foreach (var funcType in allPossFuncTypes) { var type = funcType;//closure safety menu.AddItem(new GUIContent(funcType.ToString()), false, () => chunk.SetDensityFunction(type)); } menu.DropDown(r); }
public void RemoveChunk(ChunkToGenerate chunkInfo) { Chunks.Remove(chunkInfo); }