public override void OnInspectorGUI() { serializedObject.Update(); PGCTerrain terrain = (PGCTerrain)target; PerlinBool = EditorGUILayout.Foldout(PerlinBool, "Single Perlin"); if (PerlinBool) { EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); GUILayout.Label("Perlin Noise", EditorStyles.boldLabel); EditorGUILayout.Slider(perlinScaleX, 0, 1, new GUIContent("X Scale")); EditorGUILayout.Slider(perlinScaleY, 0, 1, new GUIContent("Y Scale")); EditorGUILayout.IntSlider(perlinXOffset, 0, 100, new GUIContent("X Offset")); EditorGUILayout.IntSlider(perlinYOffset, 0, 100, new GUIContent("Y OFfset")); if (GUILayout.Button("Perlin")) { terrain.Perlin(); } } MultiPerlinBool = EditorGUILayout.Foldout(MultiPerlinBool, "Mult Perlin"); if (MultiPerlinBool) { EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); GUILayout.Label("Mulitple Perlin Noise", EditorStyles.boldLabel); EditorGUILayout.Slider(perlinScaleX, 0, 1, new GUIContent("X Scale")); EditorGUILayout.Slider(perlinScaleY, 0, 1, new GUIContent("Y Scale")); EditorGUILayout.IntSlider(perlinXOffset, 0, 100, new GUIContent("X Offset")); EditorGUILayout.IntSlider(perlinYOffset, 0, 100, new GUIContent("Y OFfset")); EditorGUILayout.IntSlider(Octaves, 1, 10, new GUIContent("Octaves")); EditorGUILayout.Slider(Persistance, 0.1f, 10, new GUIContent("Persistance")); EditorGUILayout.Slider(perlinHeightScale, 0, 1, new GUIContent("Height Scale")); GUILayout.Space(20); if (GUILayout.Button("Apply Multiple Perlin")) { terrain.MultiplePerlinTerrain(); } } showRandom = EditorGUILayout.Foldout(showRandom, "Random"); if (showRandom) { EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); GUILayout.Label("Set Heights Between Random Values", EditorStyles.boldLabel); EditorGUILayout.PropertyField(randomHeight); if (GUILayout.Button("Random Heights")) { terrain.RandomTerrain(); } } showVoronoi = EditorGUILayout.Foldout(showVoronoi, "Voronoi"); if (showVoronoi) { EditorGUILayout.Slider(vorMinPeak, 0, 1, new GUIContent("Min Peak")); EditorGUILayout.Slider(vorMaxPeak, 0, 1, new GUIContent("Max Peak")); EditorGUILayout.Slider(vorFall, 0, 10, new GUIContent("Fall off")); EditorGUILayout.Slider(vorDrop, 0, 10, new GUIContent("Drop off")); EditorGUILayout.IntSlider(vorPeaks, 1, 10, new GUIContent("voronoi Peaks")); EditorGUILayout.PropertyField(voronoiType); if (GUILayout.Button("Voronoi")) { terrain.Voronoi(); } } if (GUILayout.Button("Reset Terrain")) { terrain.ResetTerrain(); } serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { serializedObject.Update(); PGCTerrain terrain = (PGCTerrain)target; SineWaveBool = EditorGUILayout.Foldout(SineWaveBool, "Sine wave strength: "); if (SineWaveBool) { //EditorGUILayout.Slider(SineValue, 0.1f, 1, new GUIContent("Sine Value")); EditorGUILayout.Slider(waveWidth, 0.01f, 0.1f, new GUIContent("Sine width")); EditorGUILayout.Slider(waveHeight, 0.1f, 1, new GUIContent("Sine height")); if (GUILayout.Button("Do Sine Wave Function")) //Button that generates perlin { Debug.Log("Called in Editor"); terrain.MySineFuntion(); } } randomHeightBool = EditorGUILayout.Foldout(randomHeightBool, "Random height:"); if (randomHeightBool) { EditorGUILayout.Slider(QuantityRandom, 0.1f, 1, new GUIContent("Quantity")); if (GUILayout.Button("Do random function")) { Debug.Log("Called in Editor"); terrain.random(); } } perlinBool = EditorGUILayout.Foldout(perlinBool, "Perlin:"); if (perlinBool) //Button that generates perlin { EditorGUILayout.Slider(perlinXScale, 0, 1, new GUIContent("X scale")); EditorGUILayout.Slider(perlinYScale, 0, 1, new GUIContent("Y scale")); EditorGUILayout.Slider(perlinOffsetX, 0, 10000, new GUIContent("Offset X")); EditorGUILayout.Slider(perlinOffsetY, 0, 10000, new GUIContent("Offset Y")); EditorGUILayout.IntSlider(perlinOctaves, 1, 10, new GUIContent("Octaves")); EditorGUILayout.Slider(perlinPersistance, 0.1f, 10, new GUIContent("Persistance")); EditorGUILayout.Slider(perlinHeightScale, 0, 1, new GUIContent("Height Scale")); if (GUILayout.Button("Do perlin function")) { Debug.Log("Called in Editor"); terrain.Perlin(); } } multiplePerlinBool = EditorGUILayout.Foldout(multiplePerlinBool, "Multiple Perlin:"); if (multiplePerlinBool) { EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); GUILayout.Label("Multiple Perlin Noise", EditorStyles.boldLabel); perlinParameterTable = GUITableLayout.DrawTable(perlinParameterTable, serializedObject.FindProperty("perlinParameters")); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("+")) { terrain.AddNewPerlin(); } if (GUILayout.Button("-")) { terrain.RemovePerlin(); } EditorGUILayout.EndHorizontal(); if (GUILayout.Button("Apply Multiple Perlin")) { terrain.multiplePerlin(); } } veronoiBool = EditorGUILayout.Foldout(veronoiBool, "Veronoi:"); if (veronoiBool) //Button that generates voronoi { EditorGUILayout.Slider(voronoiFallOff, 0, 10, new GUIContent("Fall Off:")); EditorGUILayout.Slider(voronoiDropOff, 0, 10, new GUIContent("Drop Off:")); EditorGUILayout.Slider(voronoiMinHeight, 0, 1, new GUIContent("Minimum Height")); EditorGUILayout.Slider(voronoiMaxHeight, 0, 1, new GUIContent("Maximum Height")); EditorGUILayout.Slider(voronoiPeaks, 0, 10, new GUIContent("Number of peaks")); EditorGUILayout.PropertyField(voronoiType); if (GUILayout.Button("Do voronoi function")) { Debug.Log("Called in Editor"); terrain.Voronoi(); } } mdptBool = EditorGUILayout.Foldout(mdptBool, "Mdpt Displacement Smoothing:"); if (mdptBool) { EditorGUILayout.PropertyField(MdptheightMin); EditorGUILayout.PropertyField(MdptheightMax); EditorGUILayout.PropertyField(MdptheightDampenerPower); EditorGUILayout.PropertyField(Mdptroughness); EditorGUILayout.PropertyField(smoothAmount); if (GUILayout.Button("Mdpt")) { terrain.mdpt(); } } diagonalBool = EditorGUILayout.Foldout(diagonalBool, "Diagonal:"); if (diagonalBool) { if (GUILayout.Button("Do Diagonal")) { terrain.DiagonalLineInYourTerrain(); } } if (GUILayout.Button("Reset")) { terrain.ResetMethod(); } serializedObject.ApplyModifiedProperties(); }