Example #1
0
        public override void OnSceneGUI()
        {
            if (Application.isPlaying)
            {
                return;
            }

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

            // setup start and end positions

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

            if (go == null)
            {
                return;
            }

            var transform = go.transform;
            var startPos  = new Vector3();
            var endPos    = new Vector3();

            if (!PlayMaker.Actions.TweenHelpers.GetTargetPosition(tweenAction.fromOption, transform,
                                                                  tweenAction.fromPosition, tweenAction.fromTarget, out startPos))
            {
                return;
            }

            if (!PlayMaker.Actions.TweenHelpers.GetTargetPosition(tweenAction.toOption, transform,
                                                                  tweenAction.toPosition, tweenAction.toTarget, out endPos))
            {
                return;
            }

            EditorGUI.BeginChangeCheck();

            if (PlayMaker.Actions.TweenHelpers.CanEditTargetPosition(tweenAction.fromOption, tweenAction.fromPosition, tweenAction.fromTarget))
            {
                tweenAction.fromPosition.Value = PlayMaker.Actions.TweenHelpers.DoTargetPositionHandle(startPos, tweenAction.fromOption,
                                                                                                       transform, tweenAction.fromTarget);
            }

            if (PlayMaker.Actions.TweenHelpers.CanEditTargetPosition(tweenAction.toOption, tweenAction.toPosition, tweenAction.toTarget))
            {
                tweenAction.toPosition.Value = PlayMaker.Actions.TweenHelpers.DoTargetPositionHandle(endPos, tweenAction.toOption,
                                                                                                     transform, tweenAction.toTarget);
            }

            var rotation = transform.rotation;

            ActionHelpers.DrawWireBounds(transform, startPos, rotation, PlayMakerPrefs.TweenFromColor);
            ActionHelpers.DrawWireBounds(transform, endPos, rotation, PlayMakerPrefs.TweenToColor);
            ActionHelpers.DrawArrow(startPos, endPos, PlayMakerPrefs.TweenToColor);

            if (EditorGUI.EndChangeCheck())
            {
                FsmEditor.SaveActions();
            }
        }
Example #2
0
        public override void OnEnable()
        {
            base.OnEnable();

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