Пример #1
0
        /// <summary>
        /// Draws the fields required for a TransformParameters object
        /// </summary>
        /// <param name="transformProperty">The related serialized property</param>
        public static void DrawTransformField(ref SerializedProperty transformProperty)
        {
            SerializedProperty spaceProperty = transformProperty.FindPropertyRelative("space");

            GuiHelpers.DrawSpaceField(ref spaceProperty, "Relative Space");

            EditorGUILayout.Separator();
            SerializedProperty positionProperty = transformProperty.FindPropertyRelative("position");

            EditorGUILayout.LabelField("Position", EditorStyles.boldLabel);
            GuiHelpers.DrawVector3Field(ref positionProperty);
            SerializedProperty animatePositionProperty = transformProperty.FindPropertyRelative("animatePosition");

            animatePositionProperty.boolValue = EditorGUILayout.Toggle("Animate", animatePositionProperty.boolValue);
            if (animatePositionProperty.boolValue)
            {
                EditorGUILayout.BeginVertical();
                SerializedProperty animatedPositionSpeedProperty = transformProperty.FindPropertyRelative("positionSpeed");
                EditorGUILayout.LabelField("Speed", EditorStyles.miniBoldLabel);
                GuiHelpers.DrawVector3Field(ref animatedPositionSpeedProperty);
                EditorGUILayout.EndVertical();
                GUILayout.Space(16);
            }

            EditorGUILayout.Separator();
            SerializedProperty rotationProperty = transformProperty.FindPropertyRelative("rotation");

            EditorGUILayout.LabelField("Rotation", EditorStyles.boldLabel);
            GuiHelpers.DrawVector3Field(ref rotationProperty);
            SerializedProperty animateRotationProperty = transformProperty.FindPropertyRelative("animateRotation");

            animateRotationProperty.boolValue = EditorGUILayout.Toggle("Animate", animateRotationProperty.boolValue);
            if (animateRotationProperty.boolValue)
            {
                EditorGUILayout.BeginVertical();
                SerializedProperty animatedRotationSpeedProperty = transformProperty.FindPropertyRelative("rotationSpeed");
                EditorGUILayout.LabelField("Speed", EditorStyles.miniBoldLabel);
                GuiHelpers.DrawVector3Field(ref animatedRotationSpeedProperty);
                EditorGUILayout.EndVertical();
                GUILayout.Space(16);
            }

            EditorGUILayout.Separator();
            SerializedProperty scaleProperty = transformProperty.FindPropertyRelative("scale");

            EditorGUILayout.LabelField("Scale", EditorStyles.boldLabel);
            GuiHelpers.DrawVector3Field(ref scaleProperty);
        }
Пример #2
0
 /// <summary>
 /// Draws a Vector3 field
 /// </summary>
 /// <param name="vector3Property">The related serialized property</param>
 public static void DrawVector3Field(ref SerializedProperty vector3Property)
 {
     GuiHelpers.DrawVector3Field(ref vector3Property, "");
 }