/// <summary> Draw GUI if boolean is false </summary>
 public override void DrawFalseGUI(SerializedProperty property)
 {
     ExtraEditorUtility.TakeSpace();
     ExtraEditorUtility.AddPropertyStack(property.FindPropertyRelative("minimum"), new GUIContent("Min"));
     ExtraEditorUtility.AddPropertyStack(property.FindPropertyRelative("maximum"), new GUIContent("Max"));
     ExtraEditorUtility.DrawPropertyStack(30);
 }
        /// <summary> Draw GUI if boolean is false </summary>
        public override void DrawFalseGUI(SerializedProperty property)
        {
            float labelWidth = EditorGUIUtility.labelWidth;

            if (ShowValues())
            {
                ExtraEditorUtility.TakeSpace();
                ExtraEditorUtility.AddPropertyStack(property.FindPropertyRelative("value"), new GUIContent("V", "Current value, which moves to match target value."));
                ExtraEditorUtility.AddPropertyStack(property.FindPropertyRelative("valueTarget"), new GUIContent("T", "Target value to which value is moved to match."));
                ExtraEditorUtility.DrawPropertyStack(16);
            }

            EditorGUIUtility.labelWidth = labelWidth;

            if (property.isExpanded)
            {
                // Next line
                EditorGUI.indentLevel++;
                Rect usePosition = new Rect(ExtraEditorUtility.totalPosition);

                usePosition.y     += EditorGUIUtility.singleLineHeight;
                usePosition.height = EditorGUIUtility.singleLineHeight;

                EditorGUI.PropertyField(usePosition, property.FindPropertyRelative("speed"), new GUIContent("Speed"));
                EditorGUI.indentLevel--;
            }
        }
        /// <summary> Called when it needs to draw on the GUI  </summary>
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            ExtraEditorUtility.BeginProperty(position, GUIContent.none, property);

            property.isExpanded = EditorGUI.Foldout(new Rect(position.x, position.y, 40, position.height), property.isExpanded, label, true);
            if (property.isExpanded)
            {
                ExtraEditorUtility.PropertyFieldLine(property.FindPropertyRelative("acceleration"), new GUIContent("Acceleration", "Speed gain per second towards target value."));
                ExtraEditorUtility.PropertyFieldLine(property.FindPropertyRelative("drag"), new GUIContent("Drag", "Exponentially decreases speed. The higher it is, the faster it decays."));
                ExtraEditorUtility.PropertyFieldLine(property.FindPropertyRelative("linearDrag"), new GUIContent("Linear Drag", "Linearly decreases speed. Constant decay."));
                ExtraEditorUtility.PropertyFieldLine(property.FindPropertyRelative("linearSpeed"), new GUIContent("Linear Speed", "Linear speed. Value always moves this much per second to target. " +
                                                                                                                  "A small amount ensures the value snaps up and reaches the target."));
                ExtraEditorUtility.PropertyFieldLine(property.FindPropertyRelative("valueTarget"), new GUIContent("Target", "Target value, what the value should be."));
                ExtraEditorUtility.PropertyFieldLine(property.FindPropertyRelative("value"), new GUIContent("Value", "Current value, which moves to match target value."));

                SerializedProperty minLimit = property.FindPropertyRelative("hasMinimumLimit");
                ExtraEditorUtility.PropertyFieldLine(minLimit, new GUIContent("Has Minimum Limit", "Whether the value has a hard minimum limit. If reached, speed instantly stops."));
                if (minLimit.boolValue)
                {
                    ExtraEditorUtility.PropertyFieldLine(property.FindPropertyRelative("minimumLimit"), new GUIContent("Minimum limit", "The actual minimum limit."));
                }

                SerializedProperty maxLimit = property.FindPropertyRelative("hasMaximumLimit");
                ExtraEditorUtility.PropertyFieldLine(maxLimit, new GUIContent("Has Maximum Limit", "Whether the value has a hard maximum limit. If reached, speed instantly stops."));
                if (maxLimit.boolValue)
                {
                    ExtraEditorUtility.PropertyFieldLine(property.FindPropertyRelative("maximumLimit"), new GUIContent("Maximum limit", "The actual maximum limit."));
                }
            }

            EditorGUI.EndProperty();
        }
 /// <summary> Draw GUI if boolean is true </summary>
 public override void DrawTrueGUI(SerializedProperty property)
 {
     if (ShowValues())
     {
         ExtraEditorUtility.TakeSpace();
         ExtraEditorUtility.PropertyField(property.FindPropertyRelative("value"));
     }
 }
        /// <summary> Called when it needs to draw on the GUI  </summary>
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            ExtraEditorUtility.BeginProperty(position, GUIContent.none, property);

            property.isExpanded = EditorGUI.Foldout(new Rect(position.x, position.y, 40, position.height), property.isExpanded, label, true);
            if (property.isExpanded)
            {
                ExtraEditorUtility.PropertyFieldLine(property.FindPropertyRelative("randomTarget"), new GUIContent("Target", "Random value to choose target from."));
                ExtraEditorUtility.PropertyFieldLine(property.FindPropertyRelative("randomTime"), new GUIContent("Time", "Randomized interval for when to choose a new target."));
                ExtraEditorUtility.PropertyFieldLine(property.FindPropertyRelative("speed"), new GUIContent("Speed", "Speed with which to move value to target value."));
                ExtraEditorUtility.PropertyFieldLine(property.FindPropertyRelative("value"), new GUIContent("V", "Current value, which moves to match target value."));
            }

            EditorGUI.EndProperty();
        }
        /// <summary> Inspector GUI for this script </summary>
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            TrailRenderer renderer = (TrailRenderer)target;

            // Find options and index
            string layerName = renderer.sortingLayerName;

            if (layerNameOptions == null)
            {
                layerNameOptions = ExtraEditorUtility.GetSortingLayerNames();
            }
            if (layerNameIndex == -1)
            {
                for (int i = 0; i < layerNameOptions.Length; i++)
                {
                    if (layerName == layerNameOptions[i])
                    {
                        layerNameIndex = i;
                        break;
                    }
                }
            }

            // Sorting Layer
            layerNameIndex = EditorGUILayout.Popup("Sorting Layer", layerNameIndex, layerNameOptions);
            if (layerNameOptions[layerNameIndex] != layerName)
            {
                renderer.sortingLayerName = layerNameOptions[layerNameIndex];
            }

            // Sorting order
            int sortingOrder = EditorGUILayout.IntField("Sorting Order", renderer.sortingOrder);

            if (renderer.sortingOrder != sortingOrder)
            {
                renderer.sortingOrder = sortingOrder;
            }
        }
        /// <summary> Called when it needs to draw on the GUI  </summary>
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            ExtraEditorUtility.BeginProperty(position, label, property);

            ExtraEditorUtility.TakeSpace(32);
            SerializedProperty enumProp = property.FindPropertyRelative("mode");

            ExtraEditorUtility.DrawSettingsEnumDropdown(ExtraEditorUtility.contentPosition, enumProp);

            ExtraEditorUtility.TakeSpace();
            if (enumProp.enumValueIndex == 1 || enumProp.enumValueIndex == 0)
            {
                ExtraEditorUtility.AddPropertyStack(property.FindPropertyRelative("lerpSpeed"), new GUIContent("L", "Speed to lerp values with."));
            }
            if (enumProp.enumValueIndex == 2 || enumProp.enumValueIndex == 0)
            {
                ExtraEditorUtility.AddPropertyStack(property.FindPropertyRelative("moveSpeed"), new GUIContent("M", "Speed to move values with."));
            }
            ExtraEditorUtility.DrawPropertyStack(16);

            ExtraEditorUtility.EndProperty();
        }
 /// <summary> Draw GUI if boolean is true </summary>
 public override void DrawTrueGUI(SerializedProperty property)
 {
     ExtraEditorUtility.TakeSpace();
     ExtraEditorUtility.PropertyField(property.FindPropertyRelative("constant"));
 }
Ejemplo n.º 9
0
 /// <summary> Draw GUI if boolean is false </summary>
 public override void DrawFalseGUI(SerializedProperty property)
 {
     ExtraEditorUtility.TakeSpace();
     ExtraEditorUtility.PropertyField(property.FindPropertyRelative("variable"));
 }