Exemple #1
0
        ///////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// DrawObjectsMode
        /// # Draw al gui buttons, checboxes, ... to handle and insert objects in scene
        /// </summary>
        ///////////////////////////////////////////////////////////////////////////////////////////////////////
        void DrawObjectsMode()
        {
            EditorBasicFunctions.DrawEditorBox("Insert objects: Options", Color.white, position);

            if (!configSaver.parameters.hideBasicHelp)
            {
                EditorBasicFunctions.DrawEditorBox(EditorBasicFunctions.GetInsertModeHelpString() + " objects", Color.yellow, position);
            }

            EditorGUILayout.Separator();

            configSaver.parameters.showPrefabConfigOptions = EditorGUILayout.Foldout(configSaver.parameters.showPrefabConfigOptions, new GUIContent("Show prefab configuration options", "Show prefab configuration options"));

            if (!configSaver.parameters.showPrefabConfigOptions)
            {
            }
            else
            {
                EditorBasicFunctions.DrawEditorBox("Configuration", Color.yellow, position);

                EditorGUILayout.Separator();

                attachObjectToCollisionObject = EditorGUILayout.Toggle(new GUIContent("Attach to father", "Attach created object to hit object"), attachObjectToCollisionObject);
                EditorGUILayout.Separator();

                extraNormalOffset = EditorGUILayout.Slider(new GUIContent("Extra normal offset", "Set the extra offset using hit normal"), extraNormalOffset, -10, 10, new GUILayoutOption[] { GUILayout.Width(0.81f * position.width) });
                extraNormalOffset = Mathf.Clamp(extraNormalOffset, -10, 10);

                pivotMode = (cPivotMode)EditorGUILayout.EnumPopup(new GUIContent("Pivot mode", "Select the pivot mode to positionate prefab using hit normal"), pivotMode, new GUILayoutOption[] { GUILayout.Width(0.81f * position.width) });
                EditorGUILayout.Separator();
                EditorGUILayout.Separator();

                objectScaleRange   = EditorGUILayout.Vector2Field(new GUIContent("Scale range", "Randomize object scale between 2 values"), objectScaleRange, new GUILayoutOption[] { GUILayout.Width(0.5f * position.width) });
                objectScaleRange.x = Mathf.Clamp(objectScaleRange.x, 0.01f, 10);
                objectScaleRange.y = Mathf.Clamp(objectScaleRange.y, 0.01f, 10);

                EditorGUILayout.Separator();

                objectRotationRangeX   = EditorGUILayout.Vector2Field(new GUIContent("Rotation range X", "Randomize object rotation in X axis between 2 values"), objectRotationRangeX, new GUILayoutOption[] { GUILayout.Width(0.5f * position.width) });
                objectRotationRangeX.x = Mathf.Clamp(objectRotationRangeX.x, 0, 360);
                objectRotationRangeX.y = Mathf.Clamp(objectRotationRangeX.y, 0, 360);

                objectRotationRangeY   = EditorGUILayout.Vector2Field(new GUIContent("Rotation range Y", "Randomize object rotation in Y axis between 2 values"), objectRotationRangeY, new GUILayoutOption[] { GUILayout.Width(0.5f * position.width) });
                objectRotationRangeY.x = Mathf.Clamp(objectRotationRangeY.x, 0, 360);
                objectRotationRangeY.y = Mathf.Clamp(objectRotationRangeY.y, 0, 360);

                objectRotationRangeZ   = EditorGUILayout.Vector2Field(new GUIContent("Rotation range Z", "Randomize object rotation in Z axis between 2 values"), objectRotationRangeZ, new GUILayoutOption[] { GUILayout.Width(0.5f * position.width) });
                objectRotationRangeZ.x = Mathf.Clamp(objectRotationRangeZ.x, 0, 360);
                objectRotationRangeZ.y = Mathf.Clamp(objectRotationRangeZ.y, 0, 360);

                EditorGUILayout.Separator();
                EditorGUILayout.Separator();
            }

            EditorBasicFunctions.DrawEditorBox("Choose prefab!", Color.white, position);

            genericObject = EditorBasicFunctions.DrawPrefabList(genericObject, position);

            EditorGUILayout.Separator();
            EditorGUILayout.Separator();

            if (genericObject)
            {
                EditorBasicFunctions.DrawEditorBox(genericObject.name, Color.yellow, position);
            }
            else
            {
                EditorBasicFunctions.DrawEditorBox("No object selected to put!", Color.gray, position);
            }
        }