示例#1
0
        private void CurveChanged(object sender, BGCurveChangedArgs e)
        {
            if (Curve == null)
            {
                return;
            }

            if (undoGroup > 0)
            {
                Undo.CollapseUndoOperations(undoGroup);
            }
            undoGroup = -1;
            EditorUtility.SetDirty(Curve);

            if (Curve.FieldsCount > 0)
            {
                foreach (var field in Curve.Fields)
                {
                    EditorUtility.SetDirty(field);
                }
            }

            var pointsMode = Curve.PointsMode;

            if (Curve.PointsCount > 0 && pointsMode != BGCurve.PointsModeEnum.Inlined)
            {
                switch (pointsMode)
                {
                case BGCurve.PointsModeEnum.Components:
                    foreach (var point in Curve.Points)
                    {
                        EditorUtility.SetDirty((BGCurvePointComponent)point);
                    }
                    break;

                case BGCurve.PointsModeEnum.GameObjectsNoTransform:
                case BGCurve.PointsModeEnum.GameObjectsTransform:
                    foreach (var point in Curve.Points)
                    {
                        var curvePointGo = (BGCurvePointGO)point;
                        EditorUtility.SetDirty(curvePointGo);
                        EditorUtility.SetDirty(curvePointGo.gameObject);
                    }

                    break;
                }
            }

            foreach (var editor in editors)
            {
                editor.OnCurveChanged(e);
            }

            transformMonitor.CheckForChange();
        }
示例#2
0
        public override void OnInspectorGUI()
        {
            transformMonitor.CheckForChange();

            var point = pointReference.Point;

            if (!IsValid(point))
            {
                return;
            }

            BGEditorUtility.DisableGui(() => EditorGUILayout.TextField("BGCurve", point.Curve.gameObject.name));

            base.OnInspectorGUI();
        }
示例#3
0
        public virtual void DrawCurve()
        {
            if (transformMonitor != null)
            {
                transformMonitor.CheckForChange();
            }

            var settings = BGPrivateField.GetSettings(Math.Curve);

            BGEditorUtility.SwapGizmosColor(settings.LineColor, () =>
            {
                //========================================  Draw section
                for (var i = 0; i < Math.SectionsCount; i++)
                {
                    DrawSection(Math[i]);
                }
            });


            //========================================  Draw spheres
            if (settings.ShowSpheres)
            {
                BGEditorUtility.SwapGizmosColor(settings.SphereColor, () =>
                {
                    BeforeDrawingSpheres(settings);
                    for (var i = 0; i < Math.Curve.PointsCount; i++)
                    {
                        DrawSphere(settings, Math.GetPosition(i), settings.SphereRadius);
                    }
                    AfterDrawingSpheres();
                });
            }
        }