Esempio n. 1
0
    private void VegetationGUI(CustomTerrain terrain)
    {
        showVegetation = EditorGUILayout.Foldout(showVegetation, "Vegetation");
        if (showVegetation)
        {
            EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
            GUILayout.Label("Vegetation", EditorStyles.boldLabel);

            EditorGUILayout.IntSlider(maxTrees, 0, 10000, new GUIContent("Max Trees"));
            EditorGUILayout.IntSlider(treeSpacing, 2, 20, new GUIContent("Tree Spacing"));


            vegMapTable = GUITableLayout.DrawTable(vegMapTable,
                                                   serializedObject.FindProperty(nameof(terrain.vegetations)));
            GUILayout.Space(20);

            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("+"))
            {
                terrain.ADdNewVegetation();
            }

            if (GUILayout.Button("-"))
            {
                terrain.RemoveVegetation();
            }

            EditorGUILayout.EndHorizontal();

            if (GUILayout.Button("Apply"))
            {
                terrain.PlanVegetation();
            }

            ;
        }
    }