Exemplo n.º 1
0
        protected virtual void DrawLineRendererProperties()
        {
            if (m_controller == null)
            {
                m_controller = target as Rope2D;
            }

            //LineRenderer Properties
            DrawTitleText("LineRenderer Properties");
            m_controller.UseLineRenderer = EditorGUILayout.Toggle("Use Line Renderer", m_controller.UseLineRenderer);
            if (m_controller.UseLineRenderer)
            {
                m_controller.RopeMaterial = EditorGUILayout.ObjectField("Line Renderer Material", m_controller.RopeMaterial, typeof(Material), false) as Material;
                //m_controller.LineRendererCurveWidth = EditorGUILayout.CurveField("Curve Width", new AnimationCurve(m_controller.LineRendererCurveWidth.keys));

                if (_curveWidthProperty == null)
                {
                    _curveWidthProperty = serializedObject.FindProperty("m_lineRendererCurveWidth");
                }
                if (_curveWidthProperty != null)
                {
                    var v_oldGuiChanged = GUI.changed;
                    serializedObject.Update();
                    EditorGUILayout.PropertyField(_curveWidthProperty, new GUIContent("Curve Width"), false);
                    if (serializedObject.ApplyModifiedProperties() || GUI.changed != v_oldGuiChanged)
                    {
                        m_controller.MarkToRecreateRope();
                    }
                }
                m_controller.LineRendererCornerVertices = EditorGUILayout.IntField("Corner Vertices", m_controller.LineRendererCornerVertices);
                m_controller.LineRendererEndCapVertices = EditorGUILayout.IntField("End Cap Vertices", m_controller.LineRendererEndCapVertices);
            }
            EditorGUILayout.Separator();
        }