Пример #1
0
        internal override bool Seize(Event currentEvent, ref Vector3 position, ref string message)
        {
            if (menu.Active)
            {
                menu.OnGui(currentEvent);
                DrawActiveAnimatedTexture(menu.Point2DPosition);

                var okMessage = menu.ActiveItem != null && menu.ActiveItem.Description != null
                    ? "Release Ctrl to " + menu.ActiveItem.Description
                    : "Hover over an option and release Ctrl.";

                //out params
                position = menu.Point3DPosition;
                message  = BGSceneViewOverlay.ToOk(okMessage) + "\r\n" + menu.Details;
                //============== Ok
                return(true);
            }

            if (!(currentEvent.type == EventType.Repaint && currentEvent.control || currentEvent.type == EventType.MouseMove && currentEvent.control))
            {
                return(false);
            }

            if (Process(currentEvent, overlay.Editor.Editor.Math, BGEditorUtility.GetSceneViewHeight(), ref position, ref message))
            {
                return(true);
            }

            pointIndicatorTransition = null;

            //============== No luck
            return(false);
        }
Пример #2
0
        protected override void Animate(BGTransition.SwayTransition swayTransition, Vector3 point, float distanceToCamera, Plane plane)
        {
            //show rect
            var verts = GetVertsByPlaneAndDistance(new Vector3(swayTransition.Value, swayTransition.Value, swayTransition.Value), point, distanceToCamera, plane);
            var color = BGCurveSettingsForEditor.HandleColorForAddAndSnap3D;

            Handles.DrawSolidRectangleWithOutline(verts, color, new Color32(color.r, color.g, color.b, 255));
        }
        protected override void Animate(BGTransition.SwayTransition swayTransition, Vector3 point, float distanceToCamera, Plane plane)
        {
            rectTransition.Tick();

            var verts = GetVertsByPlaneAndDistance(new Vector3(rectTransition.Value, rectTransition.Value, rectTransition.Value), point, distanceToCamera, plane);


            var color = BGCurveSettingsForEditor.HandleColorForAddAndSnap2D;
            Handles.DrawSolidRectangleWithOutline(verts, color, new Color32(color.r, color.g, color.b, 255));
            Handles.DrawWireDisc(point, Vector3.Cross(verts[1] - verts[0], verts[2] - verts[0]), swayTransition.Value*distanceToCamera/24);
        }
        protected virtual void Animation(Plane plane, Ray ray, BGTransition.SwayTransition transition)
        {
            float enter;

            if (plane.Raycast(ray, out enter))
            {
                swayTransition.Tick();

                Animate(transition, ray.GetPoint(enter), enter, plane);
            }
        }
Пример #5
0
        protected override void Animate(BGTransition.SwayTransition swayTransition, Vector3 point, float distanceToCamera, Plane plane)
        {
            var verts = GetVertsByPlaneAndDistance(new Vector3(swayTransition.Value, swayTransition.Value, swayTransition.Value), point, distanceToCamera, plane);

            var size = swayTransition.Value * ScalePreviewPoint * distanceToCamera / 5;

            BGEditorUtility.SwapHandlesColor(PointersColor, () => { foreach (var position in verts)
                                                                    {
                                                                        Handles.ConeCap(0, position, Quaternion.LookRotation(point - position), size);
                                                                    }
                                             });
        }
Пример #6
0
        public static void DrawHandlesGuiTexture(Vector2 screenPoint, BGTransition.SwayTransition pointIndicatorTransition, Texture2D pointSelectedTexture)
        {
            pointIndicatorTransition.Tick();

            var shift = pointIndicatorTransition.Value * .5f;

            BGEditorUtility.HandlesGui(() =>
            {
                GUI.DrawTexture(
                    new Rect(screenPoint - new Vector2(shift, shift), new Vector2(pointIndicatorTransition.Value, pointIndicatorTransition.Value)),
                    pointSelectedTexture, ScaleMode.StretchToFill);
            });
        }
Пример #7
0
        protected override void Animation(Plane plane, Ray ray, BGTransition.SwayTransition transition)
        {
            var curve = overlay.Editor.Curve;

            if (!curve.Mode2DOn)
            {
                base.Animation(plane, ray, transition);
            }
            else
            {
                var settings = overlay.Editor.Settings;
                transition.Tick();
                Animate(transition, lastPosition, settings.NewPointDistance, plane);
            }
        }
 //abstract
 protected abstract void Animate(BGTransition.SwayTransition swayTransition, Vector3 point, float distanceToCamera, Plane plane);