Exemplo n.º 1
0
        override public void OnInspectorGUI()
        {
            placementHelper.objectToPlace = (Transform)EditorGUILayout.ObjectField(placementHelper.objectToPlace, typeof(Transform), true);
            placementHelper.rotation      = EditorGUILayout.Vector3Field("Rotation", placementHelper.rotation);
            placementHelper.scale         = EditorGUILayout.Vector3Field("Scale", placementHelper.scale);

            placementHelper.rotationVariation = EditorGUILayout.Vector3Field("Rotation variation", placementHelper.rotationVariation);
            placementHelper.scaleVariation    = EditorGUILayout.Vector3Field("Scale variation", placementHelper.scaleVariation);

            if (placeObjects)
            {
                if (GUILayout.Button("Stop placing"))
                {
                    placeObjects = false;
                }
            }
            else
            {
                if (GUILayout.Button("Place objects"))
                {
                    placeObjects = true;
                }
            }
            if (placementHelper.objects.Count > 0)
            {
                if (GUILayout.Button("Clear objects"))
                {
                    placementHelper.ClearObjects();
                }
            }

            // automatic
            placementHelper.automaticPerVertexPlacement = EditorGUILayout.Toggle("Automatic placement", placementHelper.automaticPerVertexPlacement);
            if (placementHelper.automaticPerVertexPlacement)
            {
                EditorGUILayout.HelpBox("Automatic placement adds objects to newly generated surfaces at given lod level. The objects are added to each vertex position.", MessageType.Info);
                placementHelper.lodLevel     = EditorGUILayout.IntField("Lod Level", placementHelper.lodLevel);
                placementHelper.objectChance = EditorGUILayout.FloatField("Object Chance", placementHelper.objectChance);
                placementHelper.minHeight    = EditorGUILayout.FloatField("Min Height", placementHelper.minHeight);
                placementHelper.maxHeight    = EditorGUILayout.FloatField("Max Height", placementHelper.maxHeight);
                placementHelper.minPolarity  = EditorGUILayout.FloatField("Min Polarity", placementHelper.minPolarity);
                placementHelper.maxPolarity  = EditorGUILayout.FloatField("Max Polarity", placementHelper.maxPolarity);

                if (GUILayout.Button("Generate Objects"))
                {
                    placementHelper.GenerateObjects();
                }
            }

            if (placementHelper.surfaceObjects.Count > 0)
            {
                if (GUILayout.Button("Clear generated objects"))
                {
                    placementHelper.ClearGeneratedObjects();
                }
            }
        }