Пример #1
0
        public override void OnSceneGUI()
        {
            if (Application.isPlaying)
            {
                return;
            }

            tweenAction = target as PlayMaker.Actions.TweenRotation;
            if (tweenAction == null) // shouldn't happen!
            {
                return;
            }

            // setup start and end positions

            var go = ActionHelpers.GetOwnerDefault(tweenAction, tweenAction.gameObject);

            if (go == null)
            {
                return;
            }

            // setup handles

            var transform = go.transform;
            //var position = transform.position;
            //var rotation = transform.rotation;
            //var handleSize = HandleUtility.GetHandleSize(position);

            var startRotation = Quaternion.identity;

            if (PlayMaker.Actions.TweenHelpers.GetTargetRotation(tweenAction.fromOptions, transform,
                                                                 tweenAction.fromRotation, tweenAction.fromTarget, out startRotation))
            {
                ActionHelpers.DrawWireBounds(transform, startRotation, PlayMakerPrefs.TweenFromColor);
            }

            var endRotation = Quaternion.identity;

            if (PlayMaker.Actions.TweenHelpers.GetTargetRotation(tweenAction.toOptions, transform,
                                                                 tweenAction.toRotation, tweenAction.toTarget, out endRotation))
            {
                ActionHelpers.DrawWireBounds(transform, endRotation, PlayMakerPrefs.TweenToColor);
            }

            /*
             * Transform fromTransform = null;
             * if (tweenAction.fromTarget != null)
             * {
             *  fromTransform = tweenAction.fromTarget.Value != null ? tweenAction.fromTarget.Value.transform : null;
             * }
             *
             * Transform toTransform = null;
             * if (tweenAction.toTarget != null)
             * {
             *  toTransform = tweenAction.toTarget.Value != null ? tweenAction.toTarget.Value.transform : null;
             * }
             *
             * var startRotation = ActionHelpers.GetTargetRotation(tweenAction.fromOptions, transform, fromTransform, tweenAction.fromRotation.Value);
             * var endRotation = ActionHelpers.GetTargetRotation(tweenAction.toOptions, transform, toTransform, tweenAction.toRotation.Value);
             *
             * var showFromHandles = ActionHelpers.CanEditTargetRotation(tweenAction.fromOptions, tweenAction.fromRotation, tweenAction.fromTarget);
             * if (showFromHandles)
             * {
             *  ActionHelpers.DrawWireBounds(transform, startRotation, PlayMakerPrefs.TweenFromColor);
             *  // Need a custom control for this?
             *  // tweenAction.fromRotation.Value = Handles.RotationHandle(tweenAction.fromRotation.Value, transform.position);
             * }
             *
             * var showToHandles = ActionHelpers.CanEditTargetRotation(tweenAction.toOptions, tweenAction.toRotation, tweenAction.toTarget);
             * if (showToHandles)
             * {
             *  ActionHelpers.DrawWireBounds(transform, endRotation, PlayMakerPrefs.TweenToColor);
             *  // Need a custom control for this?
             *  // tweenAction.fromRotation.Value = Handles.RotationHandle(tweenAction.fromRotation.Value, transform.position);
             * }*/

            if (GUI.changed)
            {
                FsmEditor.SaveActions();
            }
        }
Пример #2
0
        public override void OnEnable()
        {
            base.OnEnable();

            tweenAction = (PlayMaker.Actions.TweenRotation)target;
        }