示例#1
0
        /// <summary>
        /// Scale extension method for TransitionStep
        /// </summary>
        /// <returns></returns>
        public static Scale Scale(this TransitionStep transitionStep,
                                  Vector3 startScale,
                                  Vector3 endScale,
                                  float delay    = 0,
                                  float duration = 0.5f,
                                  TransitionStep.TransitionModeType transitionMode     = TransitionStep.TransitionModeType.Specified,
                                  TransitionStep.TimeUpdateMethodType timeUpdateMethod = TransitionStep.TimeUpdateMethodType.GameTime,
                                  TransitionHelper.TweenType tweenType = TransitionHelper.TweenType.linear,
                                  AnimationCurve animationCurve        = null,
                                  bool runAtStart = false,
                                  Action <TransitionStep> onStart    = null,
                                  Action <TransitionStep> onUpdate   = null,
                                  Action <TransitionStep> onComplete = null)
        {
            var newTransitionStep = new Scale(transitionStep.Target,
                                              startScale,
                                              endScale,
                                              delay,
                                              duration,
                                              transitionMode,
                                              timeUpdateMethod,
                                              tweenType,
                                              animationCurve,
                                              onStart,
                                              onUpdate,
                                              onComplete);

            newTransitionStep.AddToChain(transitionStep, runAtStart);
            return(newTransitionStep);
        }
示例#2
0
        /// <summary>
        /// Chain a new custom transition step with the specfied settings onto the current one.
        /// </summary>
        /// <returns></returns>
        public TransitionStep ChainCustomTransitionStep(float delay    = 0,
                                                        float duration = 0.5f,
                                                        TransitionStep.TransitionModeType transitionMode     = TransitionStep.TransitionModeType.Specified,
                                                        TransitionStep.TimeUpdateMethodType timeUpdateMethod = TransitionStep.TimeUpdateMethodType.GameTime,
                                                        TransitionHelper.TweenType tweenType = TransitionHelper.TweenType.linear,
                                                        AnimationCurve animationCurve        = null,
                                                        bool runAtStart = false,
                                                        Action <TransitionStep> onStart    = null,
                                                        Action <TransitionStep> onUpdate   = null,
                                                        Action <TransitionStep> onComplete = null)
        {
            var newTransitionStep = new TransitionStep(Target,
                                                       delay,
                                                       duration,
                                                       transitionMode,
                                                       timeUpdateMethod,
                                                       tweenType,
                                                       animationCurve,
                                                       onStart: onStart,
                                                       onUpdate: onUpdate,
                                                       onComplete: onComplete);

            newTransitionStep.AddToChain(this, runAtStart);
            return(newTransitionStep);
        }
示例#3
0
        /// <summary>
        /// ColorTransition extension method for TransitionStep
        /// </summary>
        /// <returns></returns>
        public static ColorTransition ColorTransition(this TransitionStep transitionStep,
                                                      UnityEngine.Gradient gradient,
                                                      float delay    = 0,
                                                      float duration = 0.5f,
                                                      TransitionStep.TransitionModeType transitionMode     = TransitionStep.TransitionModeType.Specified,
                                                      TransitionStep.TimeUpdateMethodType timeUpdateMethod = TransitionStep.TimeUpdateMethodType.GameTime,
                                                      TransitionHelper.TweenType tweenType = TransitionHelper.TweenType.linear,
                                                      AnimationCurve animationCurve        = null,
                                                      bool runAtStart = false,
                                                      Action <TransitionStep> onStart    = null,
                                                      Action <TransitionStep> onUpdate   = null,
                                                      Action <TransitionStep> onComplete = null)
        {
            var newTransitionStep = new ColorTransition(transitionStep.Target,
                                                        gradient,
                                                        delay,
                                                        duration,
                                                        transitionMode,
                                                        timeUpdateMethod,
                                                        tweenType,
                                                        animationCurve,
                                                        onStart,
                                                        onUpdate,
                                                        onComplete);

            newTransitionStep.AddToChain(transitionStep, runAtStart);
            return(newTransitionStep);
        }
示例#4
0
        /// <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);
        }
示例#5
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);
        }