Beispiel #1
0
        public static MoveTarget MoveTargetFromOriginal(this TransitionStep transitionStep,
                                                        Vector3 endPosition,
                                                        float delay    = 0,
                                                        float duration = 0.5f,
                                                        TransitionHelper.TweenType tweenType = TransitionHelper.TweenType.linear,
                                                        AnimationCurve animationCurve        = null,
                                                        bool runAtStart         = false,
                                                        Action onStart          = null,
                                                        Action <float> onUpdate = null,
                                                        Action onComplete       = null)
        {
            var newTransitionStep = new MoveTarget(transitionStep.Target,
                                                   Vector3.zero,
                                                   endPosition,
                                                   delay,
                                                   duration,
                                                   TransitionStep.TransitionModeType.FromCurrent,
                                                   tweenType,
                                                   animationCurve,
                                                   onStart,
                                                   onUpdate,
                                                   onComplete);

            if (runAtStart)
            {
                transitionStep.AddOnStartTransitionStep(newTransitionStep);
            }
            else
            {
                transitionStep.AddOnCompleteTransitionStep(newTransitionStep);
            }
            newTransitionStep.Parent     = transitionStep;
            newTransitionStep.StartValue = newTransitionStep.OriginalValue;
            return(newTransitionStep);
        }
        /// <summary>
        /// Animation extension method for TransitionStep
        /// </summary>
        /// <typeparam name="T">interface type</typeparam>
        /// <param name="TransitionStep"></param>
        /// <returns></returns>
        public static TriggerAnimation TriggerAnimation(this TransitionStep transitionStep,
                                                        float speed             = 1,
                                                        float delay             = 0,
                                                        float duration          = 0.5f,
                                                        string trigger          = "TransitionIn",
                                                        string targetState      = "TransitionOut",
                                                        bool runAtStart         = false,
                                                        Action onStart          = null,
                                                        Action <float> onUpdate = null,
                                                        Action onComplete       = null)
        {
            var newTransitionStep = new TriggerAnimation(transitionStep.Target,
                                                         speed,
                                                         delay,
                                                         duration,
                                                         trigger,
                                                         targetState,
                                                         onStart,
                                                         onUpdate,
                                                         onComplete);

            if (runAtStart)
            {
                transitionStep.AddOnStartTransitionStep(newTransitionStep);
            }
            else
            {
                transitionStep.AddOnCompleteTransitionStep(newTransitionStep);
            }
            newTransitionStep.Parent = transitionStep;
            return(newTransitionStep);
        }
Beispiel #3
0
        /// <summary>
        /// Fade extension method for TransitionStep
        /// </summary>
        /// <typeparam name="T">interface type</typeparam>
        /// <param name="TransitionStep"></param>
        /// <returns></returns>
        public static ScreenWipe ScreenWipe(this TransitionStep transitionStep,
                                            Texture2D maskTexture,
                                            bool invertMask   = false,
                                            Color?color       = null,
                                            Texture2D texture = null,
                                            float softness    = 0,
                                            float delay       = 0,
                                            float duration    = 0.5f,
                                            TransitionHelper.TweenType tweenType = TransitionHelper.TweenType.linear,
                                            AnimationCurve animationCurve        = null,
                                            Action onStart          = null,
                                            Action <float> onUpdate = null,
                                            Action onComplete       = null)
        {
            var newTransitionStep = new ScreenWipe(transitionStep.Target,
                                                   maskTexture,
                                                   invertMask,
                                                   color,
                                                   texture,
                                                   softness,
                                                   delay,
                                                   duration,
                                                   tweenType,
                                                   animationCurve,
                                                   onStart,
                                                   onUpdate,
                                                   onComplete);

            transitionStep.AddOnCompleteTransitionStep(newTransitionStep);
            newTransitionStep.Parent = transitionStep;
            return(newTransitionStep);
        }
Beispiel #4
0
        /// <summary>
        /// Scale extension method for TransitionStep
        /// </summary>
        /// <typeparam name="T">interface type</typeparam>
        /// <param name="TransitionStep"></param>
        /// <returns></returns>
        public static Scale ScaleToOriginal(this TransitionStep transitionStep,
                                            Vector3 startScale,
                                            float delay    = 0,
                                            float duration = 0.5f,
                                            TransitionHelper.TweenType tweenType = TransitionHelper.TweenType.linear,
                                            AnimationCurve animationCurve        = null,
                                            bool runAtStart         = false,
                                            Action onStart          = null,
                                            Action <float> onUpdate = null,
                                            Action onComplete       = null)
        {
            var newTransitionStep = new Scale(transitionStep.Target,
                                              startScale,
                                              Vector3.zero,
                                              delay,
                                              duration,
                                              TransitionStep.TransitionModeType.ToOriginal,
                                              tweenType,
                                              animationCurve,
                                              onStart,
                                              onUpdate,
                                              onComplete);

            if (runAtStart)
            {
                transitionStep.AddOnStartTransitionStep(newTransitionStep);
            }
            else
            {
                transitionStep.AddOnCompleteTransitionStep(newTransitionStep);
            }
            newTransitionStep.Parent   = transitionStep;
            newTransitionStep.EndValue = newTransitionStep.OriginalValue;
            return(newTransitionStep);
        }
 /// <summary>
 /// Add a TransitionStep that should be invoked in OnComplete.
 /// </summary>
 /// <param name="transitionStep"></param>
 /// <returns></returns>
 public TransitionStep AddOnCompleteTransitionStep(TransitionStep transitionStep)
 {
     if (transitionStep != null)
     {
         OnComplete += transitionStep.Start;
     }
     return(this);
 }
 /// <summary>
 /// Add common values to the transitionStep for the in transition
 /// </summary>
 /// <param name="transitionStep"></param>
 public override void SetupTransitionStepIn(TransitionStep transitionStep)
 {
     var transitionStepScale = transitionStep as Scale;
     if (transitionStepScale != null)
     {
         transitionStepScale.StartValue = InConfig.StartScale;
         transitionStepScale.EndValue = _originalScale;
     }
     base.SetupTransitionStepIn(transitionStep);
 }
 /// <summary>
 /// Add common values to the transitionStep for the out transition
 /// </summary>
 /// <param name="transitionStep"></param>
 public override void SetupTransitionStepOut(TransitionStep transitionStep)
 {
     var transitionStepFade = transitionStep as Fade;
     if (transitionStepFade != null)
     {
         transitionStepFade.StartValue = transitionStepFade.GetCurrent();
         transitionStepFade.EndValue = FadeOutConfig.EndTransparency;
     }
     base.SetupTransitionStepOut(transitionStep);
 }
 /// <summary>
 /// Add common values to the transitionStep for the out transition
 /// </summary>
 /// <param name="transitionStep"></param>
 public override void SetupTransitionStepOut(TransitionStep transitionStep)
 {
     var transitionStepScreenFade = transitionStep as ScreenFade;
     if (transitionStepScreenFade != null)
     {
         transitionStepScreenFade.Color = OutConfig.Color;
         transitionStepScreenFade.Texture = OutConfig.Texture;
     }
     base.SetupTransitionStepOut(transitionStep);
 }
 /// <summary>
 /// Add common values to the transitionStep for the out transition
 /// </summary>
 /// <param name="transitionStep"></param>
 public override void SetupTransitionStepOut(TransitionStep transitionStep)
 {
     var transitionStepMoveTarget = transitionStep as MoveTarget;
     if (transitionStepMoveTarget != null)
     {
         transitionStepMoveTarget.StartValue = transitionStepMoveTarget.GetCurrent();
         transitionStepMoveTarget.EndValue = MoveOutConfig.EndTarget.transform.position;
     }
     base.SetupTransitionStepOut(transitionStep);
 }
 /// <summary>
 /// Add common values to the transitionStep for the in transition
 /// </summary>
 /// <param name="transitionStep"></param>
 public override void SetupTransitionStepIn(TransitionStep transitionStep)
 {
     var transitionStepMoveTarget = transitionStep as MoveTarget;
     if (transitionStepMoveTarget != null)
     {
         transitionStepMoveTarget.StartValue = MoveInConfig.StartTarget.transform.position;
         transitionStepMoveTarget.EndValue = _originalPosition;
     }
     base.SetupTransitionStepIn(transitionStep);
 }
 /// <summary>
 /// Add common values to the transitionStep for the out transition
 /// </summary>
 /// <param name="transitionStep"></param>
 public override void SetupTransitionStepOut(TransitionStep transitionStep)
 {
     var transitionStepScreenWipe = transitionStep as TransitionStepFloat;
     if (transitionStepScreenWipe != null)
     {
         transitionStepScreenWipe.StartValue = 0;
         transitionStepScreenWipe.EndValue = 1;
     }
     base.SetupTransitionStepOut(transitionStep);
 }
 /// <summary>
 /// Add common values to the transitionStep for the out transition
 /// </summary>
 /// <param name="transitionStep"></param>
 public override void SetupTransitionStepOut(TransitionStep transitionStep)
 {
     var transitionStepScale = transitionStep as Scale;
     if (transitionStepScale != null)
     {
         transitionStepScale.StartValue = transitionStepScale.GetCurrent();
         transitionStepScale.EndValue = OutConfig.EndScale;
     }
     base.SetupTransitionStepOut(transitionStep);
 }
 /// <summary>
 /// Add common values to the transitionStep for the in transition
 /// </summary>
 /// <param name="transitionStep"></param>
 public override void SetupTransitionStepIn(TransitionStep transitionStep)
 {
     var transitionStepFade = transitionStep as Fade;
     if (transitionStepFade != null)
     {
         transitionStepFade.StartValue = FadeInConfig.StartTransparency;
         transitionStepFade.EndValue = _originalTransparency;
     }
     base.SetupTransitionStepIn(transitionStep);
 }
 /// <summary>
 /// Add common values to the transitionStep for the in transition
 /// </summary>
 /// <param name="transitionStep"></param>
 public override void SetupTransitionStepIn(TransitionStep transitionStep)
 {
     var transitionStepRotate = transitionStep as Rotate;
     if (transitionStepRotate != null)
     {
         transitionStepRotate.StartValue = InConfig.StartRotation;
         transitionStepRotate.EndValue = _originalRotation;
         transitionStepRotate.CoordinateSpace = ConvertRotationMode();
     }
     base.SetupTransitionStepIn(transitionStep);
 }
 /// <summary>
 /// Add common values to the transitionStep for the in transition
 /// </summary>
 /// <param name="transitionStep"></param>
 public override void SetupTransitionStepIn(TransitionStep transitionStep)
 {
     var transitionStepAnimation = transitionStep as TriggerAnimation;
     if (transitionStepAnimation != null)
     {
         transitionStepAnimation.Speed = InConfig.Speed;
         transitionStepAnimation.Trigger = "TransitionIn";
         transitionStepAnimation.TargetState = "TransitionIn";
     }
     base.SetupTransitionStepIn(transitionStep);
 }
 /// <summary>
 /// Add common values to the transitionStep for the out transition
 /// </summary>
 /// <param name="transitionStep"></param>
 public override void SetupTransitionStepOut(TransitionStep transitionStep)
 {
     var transitionStepScreenWipe = transitionStep as ScreenWipe;
     if (transitionStepScreenWipe != null)
     {
         transitionStepScreenWipe.MaskTexture = OutConfig.MaskTexture;
         transitionStepScreenWipe.InvertMask = OutConfig.InvertMask;
         transitionStepScreenWipe.Color = OutConfig.Color;
         transitionStepScreenWipe.Texture = OutConfig.Texture;
     }
     base.SetupTransitionStepOut(transitionStep);
 }
 /// <summary>
 /// Add common values to the transitionStep for the in transition
 /// </summary>
 /// <param name="transitionStep"></param>
 public override void SetupTransitionStepIn(TransitionStep transitionStep)
 {
     var transitionStepMove = transitionStep as Move;
     if (transitionStepMove != null)
     {
         transitionStepMove.StartValue = InConfig.StartPositionType == MoveType.FixedPosition
             ? InConfig.StartPosition
             : _originalPosition + InConfig.StartPosition; ;
         transitionStepMove.EndValue = _originalPosition;
         transitionStepMove.CoordinateSpace = ConvertMoveMode();
     }
     base.SetupTransitionStepIn(transitionStep);
 }
 public TransitionStepScreen(UnityEngine.GameObject target,
     float delay = 0,
     float duration = 0.5f,
     TransitionHelper.TweenType tweenType = TransitionHelper.TweenType.linear,
     AnimationCurve animationCurve = null,
     Action onStart = null,
     Action<float> onUpdate = null,
     TransitionStep onCompleteItem = null,
     Action onComplete = null,
     Action<object> onCompleteWithData = null,
     object onCompleteData = null)
     : base(target, delay: delay, duration: duration, tweenType: tweenType,
         animationCurve: animationCurve, onStart: onStart,onUpdate: onUpdate, onComplete: onComplete)
 {
     SetupComponentReferences();
 }
 public TransitionStepScreen(UnityEngine.GameObject target,
                             float delay    = 0,
                             float duration = 0.5f,
                             TransitionHelper.TweenType tweenType = TransitionHelper.TweenType.linear,
                             AnimationCurve animationCurve        = null,
                             Action onStart                     = null,
                             Action <float> onUpdate            = null,
                             TransitionStep onCompleteItem      = null,
                             Action onComplete                  = null,
                             Action <object> onCompleteWithData = null,
                             object onCompleteData              = null) :
     base(target, delay: delay, duration: duration, tweenType: tweenType,
          animationCurve: animationCurve, onStart: onStart, onUpdate: onUpdate, onComplete: onComplete)
 {
     SetupComponentReferences();
 }
 public Rotate(UnityEngine.GameObject target,
     Vector3? startRotation = null,
     Vector3? endRotation = null,
     float delay = 0,
     float duration = 0.5f,
     TransitionModeType transitionMode = TransitionModeType.Specified,
     TransitionHelper.TweenType tweenType = TransitionHelper.TweenType.linear,
     AnimationCurve animationCurve = null,
     TransitionStep.CoordinateSpaceType coordinateSpace = TransitionStep.CoordinateSpaceType.Global,
     Action onStart = null,
     Action<float> onUpdate = null,
     Action onComplete = null)
     : base(target, startRotation, endRotation, delay: delay, duration: duration, transitionMode: transitionMode, tweenType: tweenType,
         animationCurve: animationCurve, coordinateSpace: coordinateSpace, onStart: onStart, onUpdate: onUpdate, onComplete: onComplete)
 {
     Assert.AreNotEqual(CoordinateSpaceType.AnchoredPosition, CoordinateSpace, "AnchoredPosition is not supported for Rotate. Please change");
 }
 public TransitionStepScreen(UnityEngine.GameObject target,
                             SceneChangeModeType sceneChangeMode = SceneChangeModeType.None,
                             string sceneToLoad         = null,
                             bool skipOnCrossTransition = true,
                             float delay    = 0,
                             float duration = 0.5f,
                             TransitionHelper.TweenType tweenType = TransitionHelper.TweenType.linear,
                             AnimationCurve animationCurve        = null,
                             Action onStart                     = null,
                             Action <float> onUpdate            = null,
                             TransitionStep onCompleteItem      = null,
                             Action onComplete                  = null,
                             Action <object> onCompleteWithData = null,
                             object onCompleteData              = null) :
     base(target, delay: delay, duration: duration, tweenType: tweenType,
          animationCurve: animationCurve, onStart: onStart, onUpdate: onUpdate, onComplete: onComplete)
 {
     SceneChangeMode       = sceneChangeMode;
     SceneToLoad           = sceneToLoad;
     SkipOnCrossTransition = skipOnCrossTransition;
     SetupComponents();
 }
        /// <summary>
        /// Rotate extension method for TransitionStep
        /// </summary>
        /// <typeparam name="T">interface type</typeparam>
        /// <param name="TransitionStep"></param>
        /// <returns></returns>
        public static Rotate Rotate(this TransitionStep transitionStep,
                                    Vector3 startRotation,
                                    Vector3 endRotation,
                                    float delay    = 0,
                                    float duration = 0.5f,
                                    TransitionStep.TransitionModeType transitionMode = TransitionStep.TransitionModeType.Specified,
                                    TransitionHelper.TweenType tweenType             = TransitionHelper.TweenType.linear,
                                    AnimationCurve animationCurve = null,
                                    TransitionStep.CoordinateSpaceType coordinateMode = TransitionStep.CoordinateSpaceType.Global,
                                    bool runAtStart         = false,
                                    Action onStart          = null,
                                    Action <float> onUpdate = null,
                                    Action onComplete       = null)
        {
            var newTransitionStep = new Rotate(transitionStep.Target,
                                               startRotation,
                                               endRotation,
                                               delay,
                                               duration,
                                               transitionMode,
                                               tweenType,
                                               animationCurve,
                                               coordinateMode,
                                               onStart,
                                               onUpdate,
                                               onComplete);

            if (runAtStart)
            {
                transitionStep.AddOnStartTransitionStep(newTransitionStep);
            }
            else
            {
                transitionStep.AddOnCompleteTransitionStep(newTransitionStep);
            }
            newTransitionStep.Parent = transitionStep;
            return(newTransitionStep);
        }
Beispiel #23
0
        /// <summary>
        /// Fade extension method for TransitionStep
        /// </summary>
        /// <typeparam name="T">interface type</typeparam>
        /// <param name="TransitionStep"></param>
        /// <returns></returns>
        public static Fade Fade(this TransitionStep transitionStep,
                                float startTransparency,
                                float endTransparency,
                                float delay    = 0,
                                float duration = 0.5f,
                                TransitionStep.TransitionModeType transitionMode = TransitionStep.TransitionModeType.Specified,
                                TransitionHelper.TweenType tweenType             = TransitionHelper.TweenType.linear,
                                AnimationCurve animationCurve = null,
                                bool runAtStart         = false,
                                Action onStart          = null,
                                Action <float> onUpdate = null,
                                Action onComplete       = null)
        {
            var newTransitionStep = new Fade(transitionStep.Target,
                                             startTransparency,
                                             endTransparency,
                                             delay,
                                             duration,
                                             transitionMode,
                                             tweenType,
                                             animationCurve,
                                             onStart,
                                             onUpdate,
                                             onComplete);

            if (runAtStart)
            {
                transitionStep.AddOnStartTransitionStep(newTransitionStep);
            }
            else
            {
                transitionStep.AddOnCompleteTransitionStep(newTransitionStep);
            }
            newTransitionStep.Parent = transitionStep;
            return(newTransitionStep);
        }
 /// <summary>
 /// Add a TransitionStep that should be invoked in OnComplete.
 /// </summary>
 /// <param name="transitionStep"></param>
 /// <returns></returns>
 public TransitionStep AddOnCompleteTransitionStep(TransitionStep transitionStep)
 {
     if (transitionStep != null)
         OnComplete += transitionStep.Start;
     return this;
 }
 /// <summary>
 /// Add common values to the transitionStep for the out transition
 /// </summary>
 /// <param name="transitionStep"></param>
 public override void SetupTransitionStepOut(TransitionStep transitionStep)
 {
     var transitionStepRotate = transitionStep as Rotate;
     if (transitionStepRotate != null)
     {
         transitionStepRotate.StartValue = transitionStepRotate.GetCurrent();
         transitionStepRotate.EndValue = OutConfig.EndRotation;
         transitionStepRotate.CoordinateSpace = ConvertRotationMode();
     }
     base.SetupTransitionStepOut(transitionStep);
 }
 /// <summary>
 /// Move extension method for TransitionStep
 /// </summary>
 /// <typeparam name="T">interface type</typeparam>
 /// <param name="TransitionStep"></param>
 /// <returns></returns>
 public static Move MoveToOriginal(this TransitionStep transitionStep,
     Vector3 startPosition,
     float delay = 0,
     float duration = 0.5f,
     TransitionHelper.TweenType tweenType = TransitionHelper.TweenType.linear,
     AnimationCurve animationCurve = null,
     TransitionStep.CoordinateSpaceType coordinateMode = TransitionStep.CoordinateSpaceType.Global,
     bool runAtStart = false,
     Action onStart = null,
     Action<float> onUpdate = null,
     Action onComplete = null)
 {
     var newTransitionStep = new Move(transitionStep.Target,
         startPosition,
         Vector3.zero,
         delay,
         duration,
         TransitionStep.TransitionModeType.ToOriginal,
         tweenType,
         animationCurve,
         coordinateMode,
         onStart,
         onUpdate,
         onComplete);
     if (runAtStart)
         transitionStep.AddOnStartTransitionStep(newTransitionStep);
     else
         transitionStep.AddOnCompleteTransitionStep(newTransitionStep);
     newTransitionStep.Parent = transitionStep;
     return newTransitionStep;
 }
 /// <summary>
 /// Add common values to the transitionStep for the out transition
 /// </summary>
 /// <param name="transitionStep"></param>
 public override void SetupTransitionStepOut(TransitionStep transitionStep)
 {
     var transitionStepMove = transitionStep as Move;
     if (transitionStepMove != null)
     {
         transitionStepMove.StartValue = transitionStepMove.GetCurrent();
         transitionStepMove.EndValue = OutConfig.EndPositionType == MoveType.FixedPosition
             ? OutConfig.EndPosition
             : _originalPosition + OutConfig.EndPosition;
         transitionStepMove.CoordinateSpace = ConvertMoveMode();
     }
     base.SetupTransitionStepOut(transitionStep);
 }
 /// <summary>
 /// Add a TransitionStep that should be invoked in OnStart.
 /// </summary>
 /// <param name="transitionStep"></param>
 /// <returns></returns>
 public TransitionStep AddOnStartTransitionStep(TransitionStep transitionStep)
 {
     if (transitionStep != null)
         OnStart += transitionStep.Start;
     return this;
 }
 /// <summary>
 /// MoveTarget extension method for TransitionStep
 /// </summary>
 /// <typeparam name="T">interface type</typeparam>
 /// <param name="TransitionStep"></param>
 /// <returns></returns>
 public static MoveTarget MoveTarget(this TransitionStep transitionStep,
     Vector3 startPosition,
     Vector3 endPosition,
     float delay = 0,
     float duration = 0.5f,
     TransitionStep.TransitionModeType transitionMode = TransitionStep.TransitionModeType.Specified,
     TransitionHelper.TweenType tweenType = TransitionHelper.TweenType.linear,
     AnimationCurve animationCurve = null,
     bool runAtStart = false,
     Action onStart = null,
     Action<float> onUpdate = null,
     Action onComplete = null)
 {
     var newTransitionStep = new MoveTarget(transitionStep.Target,
         startPosition,
         endPosition,
         delay,
         duration,
         transitionMode,
         tweenType,
         animationCurve,
         onStart,
         onUpdate,
         onComplete);
     if (runAtStart)
         transitionStep.AddOnStartTransitionStep(newTransitionStep);
     else
         transitionStep.AddOnCompleteTransitionStep(newTransitionStep);
     newTransitionStep.Parent = transitionStep;
     return newTransitionStep;
 }
 /// <summary>
 /// Add common values to the transitionStep for the out transition
 /// </summary>
 /// <param name="transitionStep"></param>
 public virtual void SetupTransitionStepOut(TransitionStep transitionStep)
 {
     transitionStep.Delay = TransitionOutConfig.Delay;
     transitionStep.Duration = TransitionOutConfig.Duration;
     transitionStep.TweenType = TransitionOutConfig.TransitionType;
     transitionStep.AnimationCurve = TransitionOutConfig.AnimationCurve;
     transitionStep.OnStart += TransitionOutStart;
     transitionStep.OnComplete += TransitionOutComplete;
     transitionStep.OnUpdate += ValueUpdated;
 }