Example #1
0
            public override void OnGUI()
            {
                s_Radius.value       = EditorGUILayout.FloatField("Radius", s_Radius);
                s_Height.value       = EditorGUILayout.FloatField("Height", s_Height);
                s_AxisSegments.value = EditorGUILayout.IntField("Number of Sides", s_AxisSegments);

                s_Radius.value       = Mathf.Clamp(s_Radius.value, k_MinShapeDimensions.x, k_MaxShapeDimensions.x);
                s_Height.value       = Mathf.Clamp(s_Height.value, k_MinShapeDimensions.x, k_MaxShapeDimensions.x);
                s_AxisSegments.value = PMath.Clamp(s_AxisSegments, 3, 64);
            }
            public override void OnGUI()
            {
                s_Radius.value         = EditorGUILayout.FloatField("Radius", s_Radius);
                s_Height.value         = EditorGUILayout.FloatField("Height", s_Height);
                s_Thickness.value      = EditorGUILayout.FloatField("Thickness", s_Thickness);
                s_AxisSegments.value   = EditorGUILayout.IntField("Number of Sides", s_AxisSegments);
                s_HeightSegments.value = EditorGUILayout.IntField("Height Segments", s_HeightSegments);

                s_Radius.value         = Mathf.Clamp(s_Radius.value, k_MinShapeDimensions.x, k_MaxShapeDimensions.x);
                s_Height.value         = Mathf.Clamp(s_Height.value, k_MinShapeDimensions.x, k_MaxShapeDimensions.x);
                s_HeightSegments.value = (int)Mathf.Clamp(s_HeightSegments, 0f, 32f);
                s_Thickness.value      = Mathf.Clamp(s_Thickness, .01f, s_Radius - .01f);
                s_AxisSegments.value   = PMath.Clamp(s_AxisSegments, 3, 64);
                s_HeightSegments.value = PMath.Clamp(s_HeightSegments.value, 0, 128);
            }
            public override void OnGUI()
            {
                s_Axis.value = (Axis)EditorGUILayout.EnumPopup("Axis", s_Axis);

                s_Width.value  = EditorGUILayout.FloatField("Width", s_Width);
                s_Height.value = EditorGUILayout.FloatField("Length", s_Height);
                s_Width.value  = Mathf.Clamp(s_Width.value, k_MinShapeDimensions.x, k_MaxShapeDimensions.x);
                s_Height.value = Mathf.Clamp(s_Height.value, k_MinShapeDimensions.x, k_MaxShapeDimensions.x);

                s_WidthSegments.value  = EditorGUILayout.IntField("Width Segments", s_WidthSegments);
                s_HeightSegments.value = EditorGUILayout.IntField("Length Segments", s_HeightSegments);

                s_WidthSegments.value  = PMath.Clamp(s_WidthSegments.value, 0, 512);
                s_HeightSegments.value = PMath.Clamp(s_HeightSegments.value, 0, 512);
            }
            public override void OnGUI()
            {
                s_Steps.value         = (int)Mathf.Max(UI.EditorGUIUtility.FreeSlider("Steps", s_Steps, 2, 64), 2);
                s_Steps.value         = PMath.Clamp(s_Steps, 2, 512);
                s_Sides.value         = EditorGUILayout.Toggle("Build Sides", s_Sides);
                s_Circumference.value = EditorGUILayout.Slider("Curvature", s_Circumference, 0f, 360f);

                Vector3 size = s_Size.value;

                if (s_Circumference > 0f)
                {
                    s_Mirror.value = EditorGUILayout.Toggle("Mirror", s_Mirror);

                    size.x =
                        Mathf.Max(
                            UI.EditorGUIUtility.FreeSlider(
                                new GUIContent("Stair Width", "The width of an individual stair step."), size.x,
                                .01f, 10f), .01f);
                    size.y =
                        Mathf.Max(
                            UI.EditorGUIUtility.FreeSlider(
                                new GUIContent("Stair Height",
                                               "The total height of this staircase.  You may enter any value in the float field."),
                                size.y, .01f, 10f), .01f);
                    size.z =
                        Mathf.Max(
                            UI.EditorGUIUtility.FreeSlider(
                                new GUIContent("Inner Radius", "The distance from the center that stairs begin."),
                                size.z, 0f, 10f), 0f);

                    s_Size.value = size;
                }
                else
                {
                    size.x = UI.EditorGUIUtility.FreeSlider("Width", size.x, 0.01f, 10f);
                    size.y = UI.EditorGUIUtility.FreeSlider("Height", size.y, 0.01f, 10f);
                    size.z = UI.EditorGUIUtility.FreeSlider("Depth", size.z, 0.01f, 10f);
                }

                s_Size.value = PMath.Clamp(size, k_MinShapeDimensions, k_MaxShapeDimensions);
            }
Example #5
0
 static ShapeBuilder GetActiveShapeBuilder()
 {
     return(s_ShapeBuilders[PMath.Clamp(s_CurrentIndex, 0, s_ShapeBuilders.Length - 1)]);
 }