예제 #1
0
        /// <summary>
        /// VolumeTransition extension method for TransitionStep
        /// </summary>
        /// <returns></returns>
        public static VolumeTransition VolumeToCurrent(this TransitionStep transitionStep,
                                                       float startVolume,
                                                       float delay    = 0,
                                                       float duration = 0.5f,
                                                       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 = transitionStep.VolumeTransition(startVolume,
                                                                    0,
                                                                    delay,
                                                                    duration,
                                                                    TransitionStep.TransitionModeType.ToCurrent,
                                                                    timeUpdateMethod,
                                                                    tweenType,
                                                                    animationCurve,
                                                                    runAtStart,
                                                                    onStart,
                                                                    onUpdate,
                                                                    onComplete);

            return(newTransitionStep);
        }
예제 #2
0
파일: Fade.cs 프로젝트: mymy0301/escapeplan
        /// <summary>
        /// Fade extension method for TransitionStep
        /// </summary>
        /// <returns></returns>
        public static Fade FadeFromOriginal(this TransitionStep transitionStep,
                                            float endTransparency,
                                            float delay    = 0,
                                            float duration = 0.5f,
                                            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 = transitionStep.Fade(0,
                                                        endTransparency,
                                                        delay,
                                                        duration,
                                                        TransitionStep.TransitionModeType.FromOriginal,
                                                        timeUpdateMethod,
                                                        tweenType,
                                                        animationCurve,
                                                        runAtStart,
                                                        onStart,
                                                        onUpdate,
                                                        onComplete);

            return(newTransitionStep);
        }
예제 #3
0
        /// <summary>
        /// Fade extension method for TransitionStep
        /// </summary>
        /// <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,
                                            TransitionStep.TimeUpdateMethodType timeUpdateMethod = TransitionStep.TimeUpdateMethodType.GameTime,
                                            TransitionHelper.TweenType tweenType = TransitionHelper.TweenType.linear,
                                            AnimationCurve animationCurve        = null,
                                            Action <TransitionStep> onStart      = null,
                                            Action <TransitionStep> onUpdate     = null,
                                            Action <TransitionStep> onComplete   = null)
        {
            var newTransitionStep = new ScreenWipe(transitionStep.Target,
                                                   maskTexture,
                                                   invertMask,
                                                   color,
                                                   texture,
                                                   softness,
                                                   delay,
                                                   duration,
                                                   timeUpdateMethod,
                                                   tweenType,
                                                   animationCurve,
                                                   onStart,
                                                   onUpdate,
                                                   onComplete);

            newTransitionStep.AddToChain(transitionStep, false);
            return(newTransitionStep);
        }
예제 #4
0
        /// <summary>
        /// Scale extension method for TransitionStep
        /// </summary>
        /// <returns></returns>
        public static Scale ScaleFromCurrent(this TransitionStep transitionStep,
                                             Vector3 endScale,
                                             float delay    = 0,
                                             float duration = 0.5f,
                                             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 = transitionStep.Scale(Vector3.zero,
                                                         endScale,
                                                         delay,
                                                         duration,
                                                         TransitionStep.TransitionModeType.FromCurrent,
                                                         timeUpdateMethod,
                                                         tweenType,
                                                         animationCurve,
                                                         runAtStart,
                                                         onStart,
                                                         onUpdate,
                                                         onComplete);

            return(newTransitionStep);
        }
예제 #5
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);
        }
 /// <summary>
 /// Called when an out transition is started
 /// </summary>
 protected virtual void TransitionStart(TransitionStep transitionStep)
 {
     if (TransitionStartEvent != null)
     {
         Fsm.Event(TransitionStartEvent);
     }
 }
 /// <summary>
 /// Called when an in transition has been completed (or interupted)
 /// </summary>
 protected virtual void TransitionComplete(TransitionStep transitionStep)
 {
     if (TransitionCompleteEvent != null)
     {
         Fsm.Event(TransitionCompleteEvent);
     }
 }
예제 #8
0
 /// <summary>
 /// Override this if you need to do any specific action when the value is updated
 /// </summary>
 /// <param name="amount"></param>
 protected virtual void TransitionOutUpdate(TransitionStep transitionStep)
 {
     if (TransitionOutConfig.OnTransitionUpdate != null)
     {
         TransitionOutConfig.OnTransitionUpdate.Invoke(transitionStep);
     }
 }
예제 #9
0
        /// <summary>
        /// ColorTransition extension method for TransitionStep
        /// </summary>
        /// <returns></returns>
        public static ColorTransition ColorTransitionFromCurrent(this TransitionStep transitionStep,
                                                                 Color endColor,
                                                                 float delay    = 0,
                                                                 float duration = 0.5f,
                                                                 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 = transitionStep.ColorTransition(Color.black,
                                                                   endColor,
                                                                   delay,
                                                                   duration,
                                                                   TransitionStep.TransitionModeType.FromCurrent,
                                                                   timeUpdateMethod,
                                                                   tweenType,
                                                                   animationCurve,
                                                                   runAtStart,
                                                                   onStart,
                                                                   onUpdate,
                                                                   onComplete);

            return(newTransitionStep);
        }
예제 #10
0
파일: QHsm.cs 프로젝트: klhurley/qf4net
            internal TransitionStep this[int index]
            {
                get
                {
                    TransitionStep transitionStep = new TransitionStep();
                    transitionStep.State = m_StateChain[index];

                    int bitPos = index * 2;
                    if (m_ActionBits[bitPos])
                    {
                        if (m_ActionBits[bitPos + 1])
                        {
                            transitionStep.QSignal = QSignals.Exit;
                        }
                        else
                        {
                            transitionStep.QSignal = QSignals.Entry;
                        }
                    }
                    else
                    {
                        if (m_ActionBits[bitPos + 1])
                        {
                            transitionStep.QSignal = QSignals.Init;
                        }
                        else
                        {
                            transitionStep.QSignal = QSignals.Empty;
                        }
                    }
                    return(transitionStep);
                }
            }
예제 #11
0
        /// <summary>
        /// ColorTransition extension method for TransitionStep
        /// </summary>
        /// <returns></returns>
        public static ColorTransition ColorTransitionToOriginal(this TransitionStep transitionStep,
                                                                UnityEngine.Gradient gradient,
                                                                float delay    = 0,
                                                                float duration = 0.5f,
                                                                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 = transitionStep.ColorTransition(gradient,
                                                                   delay,
                                                                   duration,
                                                                   TransitionStep.TransitionModeType.ToOriginal,
                                                                   timeUpdateMethod,
                                                                   tweenType,
                                                                   animationCurve,
                                                                   runAtStart,
                                                                   onStart,
                                                                   onUpdate,
                                                                   onComplete);

            return(newTransitionStep);
        }
예제 #12
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);
        }
예제 #13
0
        /// <summary>
        /// Move extension method for TransitionStep
        /// </summary>
        /// <returns></returns>
        public static Move MoveFromOriginal(this TransitionStep transitionStep,
                                            Vector3 endPosition,
                                            float delay    = 0,
                                            float duration = 0.5f,
                                            TransitionStep.TimeUpdateMethodType timeUpdateMethod = TransitionStep.TimeUpdateMethodType.GameTime,
                                            TransitionHelper.TweenType tweenType = TransitionHelper.TweenType.linear,
                                            AnimationCurve animationCurve        = null,
                                            TransitionStep.CoordinateSpaceType coordinateMode = TransitionStep.CoordinateSpaceType.Global,
                                            bool runAtStart = false,
                                            Action <TransitionStep> onStart    = null,
                                            Action <TransitionStep> onUpdate   = null,
                                            Action <TransitionStep> onComplete = null)
        {
            var newTransitionStep = transitionStep.Move(Vector3.zero,
                                                        endPosition,
                                                        delay,
                                                        duration,
                                                        TransitionStep.TransitionModeType.FromOriginal,
                                                        timeUpdateMethod,
                                                        tweenType,
                                                        animationCurve,
                                                        coordinateMode,
                                                        runAtStart,
                                                        onStart,
                                                        onUpdate,
                                                        onComplete);

            return(newTransitionStep);
        }
예제 #14
0
 /// <summary>
 /// Initialise for a transition out.
 /// </summary>
 public virtual void InitTransitionOut()
 {
     SetupInitialStateOnce();
     TransitionMode        = TransitionModeType.Out;
     CurrentTransitionStep = CreateTransitionStepOut();
     CurrentTransitionStep.SetProgressToStart();
 }
예제 #15
0
        /// <summary>
        /// Step 5 - Demonstrates fading and scaling at the same time using runAtStart on the second transition.
        /// </summary>
        void Step5FadeAndScale(TransitionStep transitionStep)
        {
            ShowTransitionedDescription("Fade and Scale in one.");

            // fade the end text in while at the same time scaling.
            new Fade(TestGameObject5, 0, 1, 0, 4).
            ScaleToOriginal(Vector3.zero, 0, 3, runAtStart: true).GetChainRoot().Start();
        }
예제 #16
0
        /// <summary>
        /// Called when an in transition has been completed (or interupted)
        /// </summary>
        protected virtual void TransitionComplete(TransitionStep transitionStep)
        {
            //if (OnTransitionComplete != null)
            //    OnTransitionComplete.Invoke(transitionStep);
//#if GAME_FRAMEWORK
//            GameFramework.GameStructure.Game.GameActionHelper.PerformActions(TransitionInConfig.OnTransitionCompleteActionReferences, this, false);
//#endif
        }
예제 #17
0
        /// <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 Move;

            transitionStepMoveTarget.StartValue = ShownPosition;
            transitionStepMoveTarget.EndValue   = HiddenPosition;
            base.SetupTransitionStepOut(transitionStep);
        }
예제 #18
0
 protected override void TransitionOutStart(TransitionStep transitionStep)
 {
     if (CrossTransitionTarget != null)
     {
         CrossTransitionRenderTexture = new RenderTexture(UnityEngine.Screen.width, UnityEngine.Screen.height, 24);
         CrossTransitionTarget.gameObject.SetActive(true);
         CrossTransitionTarget.targetTexture = CrossTransitionRenderTexture;
     }
     base.TransitionOutStart(transitionStep);
 }
 /// <summary>
 /// Add common values to the transitionStep for the in transition
 /// </summary>
 /// <param name="transitionStep"></param>
 public virtual void SetupTransitionStep(TransitionStep transitionStep)
 {
     transitionStep.Delay            = Delay.Value;
     transitionStep.Duration         = Duration.Value;
     transitionStep.TimeUpdateMethod = (TransitionStep.TimeUpdateMethodType)TimeUpdateMethod.Value;
     transitionStep.TweenType        = (TransitionHelper.TweenType)TransitionType.Value;
     transitionStep.AnimationCurve   = AnimationCurve.curve;
     transitionStep.OnStart          = TransitionStart;
     transitionStep.OnComplete       = TransitionComplete;
 }
예제 #20
0
 /// <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;
 }
예제 #21
0
        /// <summary>
        /// Add common values to the transitionStep for the in transition
        /// </summary>
        /// <param name="transitionStep"></param>
        public override void SetupTransitionStep(TransitionStep transitionStep)
        {
            var transitionStepColor = transitionStep as ColorTransition;

            if (transitionStepColor != null)
            {
                transitionStepColor.Gradient = Gradient;
            }
            base.SetupTransitionStep(transitionStep);
        }
예제 #22
0
        /// <summary>
        /// Add common values to the transitionStep for the out transition
        /// </summary>
        /// <param name="transitionStep"></param>
        public override void SetupTransitionStepOut(TransitionStep transitionStep)
        {
            var transitionStepVolume = transitionStep as VolumeTransition;

            if (transitionStepVolume != null)
            {
                transitionStepVolume.StartValue = transitionStepVolume.GetCurrent();
                transitionStepVolume.EndValue   = OutConfig.EndVolume;
            }
            base.SetupTransitionStepOut(transitionStep);
        }
예제 #23
0
        /// <summary>
        /// Add common values to the transitionStep for the in transition
        /// </summary>
        /// <param name="transitionStep"></param>
        public override void SetupTransitionStep(TransitionStep transitionStep)
        {
            var transitionStepVolume = transitionStep as VolumeTransition;

            if (transitionStepVolume != null)
            {
                transitionStepVolume.StartValue = StartVolume.Value;
                transitionStepVolume.EndValue   = EndVolume.Value;
            }
            base.SetupTransitionStep(transitionStep);
        }
예제 #24
0
        /// <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);
        }
예제 #25
0
        /// <summary>
        /// Add common values to the transitionStep for the in transition
        /// </summary>
        /// <param name="transitionStep"></param>
        public override void SetupTransitionStep(TransitionStep transitionStep)
        {
            var transitionStepRotate = transitionStep as TransitionSteps.Rotate;

            if (transitionStepRotate != null)
            {
                transitionStepRotate.StartValue = StartRotation;
                transitionStepRotate.EndValue   = EndRotation;
            }
            base.SetupTransitionStep(transitionStep);
        }
예제 #26
0
        /// <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);
        }
예제 #27
0
        /// <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);
        }
예제 #28
0
        /// <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);
        }
예제 #29
0
        /// <summary>
        /// Add common values to the transitionStep for the in transition
        /// </summary>
        /// <param name="transitionStep"></param>
        public override void SetupTransitionStep(TransitionStep transitionStep)
        {
            var transitionStepFade = transitionStep as Fade;

            if (transitionStepFade != null)
            {
                transitionStepFade.StartValue = StartTransparency.Value;
                transitionStepFade.EndValue   = EndTransparency.Value;
            }
            base.SetupTransitionStep(transitionStep);
        }
예제 #30
0
        /// <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);
        }
예제 #31
0
            internal TransitionStep this[int index]
            {
                get
                {
                    TransitionStep transitionStep = new TransitionStep();
                    transitionStep.StateMethod = m_StateMethodChain[index];

                    int bitPos = index * 2;
                    if (m_ActionBits[bitPos])
                    {
                        if (m_ActionBits[bitPos + 1])
                        {
                            transitionStep.QSignal = QSignals.Exit;
                        }
                        else
                        {
                            transitionStep.QSignal = QSignals.Entry;
                        }
                    }
                    else
                    {
                        if (m_ActionBits[bitPos + 1])
                        {
                            transitionStep.QSignal = QSignals.Init;
                        }
                        else
                        {
                            transitionStep.QSignal = QSignals.Empty;
                        }
                    }
                    return transitionStep;
                }
            }