Exemple #1
0
        public override void OnEnter()
        {
            var _target = Fsm.GetOwnerDefaultTarget(gameObject);

            if (_target != null)
            {
                if (transforms.Length >= 2)
                {
                    waypoints = new Vector3[transforms.Length];
                    for (int i = 0; i < transforms.Length; i++)
                    {
                        if (transforms[i].IsNone)
                        {
                            waypoints[waypoints.Length - 1 - i] = vectors[i].IsNone ? Vector3.zero : vectors[i].Value;
                        }
                        else
                        {
                            if (transforms[i].Value == null)
                            {
                                waypoints[waypoints.Length - 1 - i] = vectors[i].IsNone ? Vector3.zero : vectors[i].Value;
                            }
                            else
                            {
                                waypoints[waypoints.Length - 1 - i] = (dotweenTypeSelect == doTweenType.DoPath ? transforms[i].Value.transform.position : transforms[i].Value.transform.localPosition) + (vectors[i].IsNone ? Vector3.zero : vectors[i].Value);
                            }
                        }
                    }
                }
            }

            if (loopDontFinish.Value == true)
            {
                settingLoops = -1;
            }
            else
            {
                settingLoops = loopsQuantity.Value;
            }


            setFinal = new TweenParams().SetDelay(setDelay.Value).SetAutoKill(setAutoKill.Value).SetSpeedBased(isSpeedBased.Value).SetRelative(setRelative.Value).OnComplete(MyCallback);



            switch (loopTypeSelect)
            {
            case loopType.None:
                if (settingLoops > 0 || settingLoops < 0)
                {
                    Debug.LogWarning("<b>[DotweenPathTransformTo]</b><color=#FF9900ff>!!! Loop Time is set but no 'Loop Type' is selected !!! </color>", this.Owner);
                }
                break;

            case loopType.Yoyo:
                setFinal.SetLoops(settingLoops, LoopType.Yoyo);
                break;

            case loopType.Restart:
                setFinal.SetLoops(settingLoops, LoopType.Restart);
                break;

            case loopType.Incremental:
                setFinal.SetLoops(settingLoops, LoopType.Incremental);
                break;
            }



            if (!tag.IsNone)
            {
                setFinal.SetId(tag.Value);
            }
            bool _isNullOrEmpty = orInputID.IsNone || orInputID == null || string.IsNullOrEmpty(orInputID.Value);

            if (_isNullOrEmpty == false)
            {
                setFinal.SetId(orInputID.Value);
            }
            bool obj_isNullOrEmpty = gameObjectId.IsNone || gameObjectId.Value == false;

            if (obj_isNullOrEmpty == false)
            {
                setFinal.SetId(Fsm.GetOwnerDefaultTarget(gameObject));
            }



            switch (easeTypeSelect)
            {
            case setEaseType.none:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.Linear);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.Linear));
                }
                break;

            case setEaseType.InSine:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InSine);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InSine));
                }
                break;

            case setEaseType.OutSine:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutSine);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutSine));
                }
                break;

            case setEaseType.InOutSine:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutSine);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutSine));
                }
                break;

            case setEaseType.InQuad:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InQuad);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InQuad));
                }
                break;

            case setEaseType.OutQuad:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutQuad);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutQuad));
                }
                break;

            case setEaseType.InOutQuad:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutQuad);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutQuad));
                }
                break;

            case setEaseType.InCubic:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InCubic);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InCubic));
                }
                break;

            case setEaseType.OutCubic:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutCubic);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutCubic));
                }
                break;

            case setEaseType.InOutCubic:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutCubic);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutCubic));
                }
                break;

            case setEaseType.InQuart:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InQuart);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InQuart));
                }
                break;

            case setEaseType.OutQuart:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutQuart);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutQuart));
                }
                break;

            case setEaseType.InOutQuart:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutQuart);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutQuart));
                }
                break;

            case setEaseType.InQuint:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InQuint);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InQuint));
                }
                break;

            case setEaseType.OutQuint:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutQuint);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutQuint));
                }
                break;

            case setEaseType.InOutQuint:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutQuint);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutQuint));
                }
                break;

            case setEaseType.InExpo:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InExpo);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InExpo));
                }
                break;

            case setEaseType.OutExpo:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutExpo);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutExpo));
                }
                break;

            case setEaseType.InOutExpo:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutExpo);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutExpo));
                }
                break;

            case setEaseType.InCirc:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InCirc);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InCirc));
                }
                break;

            case setEaseType.OutCirc:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutCirc);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutCirc));
                }
                break;

            case setEaseType.InOutCirc:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutCirc);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutCirc));
                }
                break;

            case setEaseType.InElastic:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InElastic);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InElastic));
                }
                break;

            case setEaseType.OutElastic:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutElastic);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutElastic));
                }
                break;

            case setEaseType.InOutElastic:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutElastic);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutElastic));
                }
                break;

            case setEaseType.InBack:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InBack);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InBack));
                }
                break;

            case setEaseType.OutBack:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutBack);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutBack));
                }
                break;

            case setEaseType.InOutBack:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutBack);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutBack));
                }
                break;

            case setEaseType.InBounce:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InBounce);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InBounce));
                }
                break;

            case setEaseType.OutBounce:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutBounce);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutBounce));
                }
                break;

            case setEaseType.InOutBounce:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutBounce);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutBounce));
                }
                break;

            case setEaseType.Flash:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.Flash);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.Flash));
                }
                break;

            case setEaseType.InFlash:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InFlash);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InFlash));
                }
                break;

            case setEaseType.OutFlash:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutFlash);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutFlash));
                }
                break;

            case setEaseType.InOutFlash:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutFlash);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutFlash));
                }
                break;

            case setEaseType.AnimationCurve:
                setFinal.SetEase(animationCurve.curve);
                break;
            }

            // Update + TimeScale

            switch (updateTypeSelect)
            {
            case updateType.Normal:
                setFinal.SetUpdate(UpdateType.Normal, isTimeIndependent.Value);
                break;

            case updateType.Fixed:
                setFinal.SetUpdate(UpdateType.Fixed, isTimeIndependent.Value);
                break;

            case updateType.Late:
                setFinal.SetUpdate(UpdateType.Late, isTimeIndependent.Value);
                break;
            }



            switch (pathTypeSelect)
            {
            case doPathType.CatmullRom:
                pathTypeSelected = PathType.CatmullRom;
                break;

            case doPathType.Linear:
                pathTypeSelected = PathType.Linear;
                break;
            }


            switch (pathModeSelect)
            {
            case doPathMode.Full3D:
                pathModeSelected = PathMode.Full3D;
                break;

            case doPathMode.Ignore:
                pathModeSelected = PathMode.Ignore;
                break;

            case doPathMode.Sidescroller2D:
                pathModeSelected = PathMode.Sidescroller2D;
                break;

            case doPathMode.TopDown2D:
                pathModeSelected = PathMode.TopDown2D;
                break;
            }


            // Easy part to edit for other DotTween actions --->

            switch (dotweenTypeSelect)
            {
            case doTweenType.DoPath:

                if (gizmoOff.Value == true)
                {
                    _target.transform.DOPath(waypoints, duration.Value, pathTypeSelected, pathModeSelected, resolution.Value).SetAs(setFinal);
                }

                else
                {
                    _target.transform.DOPath(waypoints, duration.Value, pathTypeSelected, pathModeSelected, resolution.Value, gizmoColor.Value).SetAs(setFinal);
                }
                break;

            case doTweenType.DoLocalPath:
                if (gizmoOff.Value == true)
                {
                    _target.transform.DOLocalPath(waypoints, duration.Value, pathTypeSelected, pathModeSelected, resolution.Value).SetAs(setFinal);
                }
                else
                {
                    _target.transform.DOLocalPath(waypoints, duration.Value, pathTypeSelected, pathModeSelected, resolution.Value, gizmoColor.Value).SetAs(setFinal);
                }

                break;
            }

            // <---


            if (startEvent != null)
            {
                Fsm.Event(startEvent);
                Finish();
            }
        }
Exemple #2
0
        public override void OnEnter()
        {
            var _target = Fsm.GetOwnerDefaultTarget(gameObject);

            if (loopDontFinish.Value == true)
            {
                settingLoops = -1;
            }
            else
            {
                settingLoops = loopsQuantity.Value;
            }

            setFinal = new TweenParams().SetDelay(setDelay.Value).SetAutoKill(setAutoKill.Value).SetRecyclable(setRecycle.Value).SetSpeedBased(isSpeedBased.Value).SetRelative(setRelative.Value).OnComplete(MyCallback);



            switch (loopTypeSelect)
            {
            case loopType.None:
                if (settingLoops > 0 || settingLoops < 0)
                {
                    Debug.LogWarning("<b>[DotweenCamera]</b><color=#FF9900ff>!!! Loop Time is set but no 'Loop Type' is selected !!! </color>", this.Owner);
                }
                break;

            case loopType.Yoyo:
                setFinal.SetLoops(settingLoops, LoopType.Yoyo);
                break;

            case loopType.Restart:
                setFinal.SetLoops(settingLoops, LoopType.Restart);
                break;

            case loopType.Incremental:
                setFinal.SetLoops(settingLoops, LoopType.Incremental);
                break;
            }



            if (!tag.IsNone)
            {
                setFinal.SetId(tag.Value);
            }
            bool _isNullOrEmpty = orInputID.IsNone || orInputID == null || string.IsNullOrEmpty(orInputID.Value);

            if (_isNullOrEmpty == false)
            {
                setFinal.SetId(orInputID.Value);
            }
            bool obj_isNullOrEmpty = gameObjectId.IsNone || gameObjectId.Value == false;

            if (obj_isNullOrEmpty == false)
            {
                setFinal.SetId(Fsm.GetOwnerDefaultTarget(gameObject));
            }



            switch (easeTypeSelect)
            {
            case setEaseType.none:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.Linear);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.Linear));
                }
                break;

            case setEaseType.InSine:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InSine);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InSine));
                }
                break;

            case setEaseType.OutSine:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutSine);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutSine));
                }
                break;

            case setEaseType.InOutSine:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutSine);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutSine));
                }
                break;

            case setEaseType.InQuad:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InQuad);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InQuad));
                }
                break;

            case setEaseType.OutQuad:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutQuad);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutQuad));
                }
                break;

            case setEaseType.InOutQuad:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutQuad);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutQuad));
                }
                break;

            case setEaseType.InCubic:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InCubic);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InCubic));
                }
                break;

            case setEaseType.OutCubic:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutCubic);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutCubic));
                }
                break;

            case setEaseType.InOutCubic:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutCubic);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutCubic));
                }
                break;

            case setEaseType.InQuart:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InQuart);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InQuart));
                }
                break;

            case setEaseType.OutQuart:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutQuart);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutQuart));
                }
                break;

            case setEaseType.InOutQuart:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutQuart);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutQuart));
                }
                break;

            case setEaseType.InQuint:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InQuint);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InQuint));
                }
                break;

            case setEaseType.OutQuint:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutQuint);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutQuint));
                }
                break;

            case setEaseType.InOutQuint:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutQuint);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutQuint));
                }
                break;

            case setEaseType.InExpo:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InExpo);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InExpo));
                }
                break;

            case setEaseType.OutExpo:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutExpo);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutExpo));
                }
                break;

            case setEaseType.InOutExpo:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutExpo);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutExpo));
                }
                break;

            case setEaseType.InCirc:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InCirc);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InCirc));
                }
                break;

            case setEaseType.OutCirc:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutCirc);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutCirc));
                }
                break;

            case setEaseType.InOutCirc:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutCirc);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutCirc));
                }
                break;

            case setEaseType.InElastic:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InElastic);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InElastic));
                }
                break;

            case setEaseType.OutElastic:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutElastic);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutElastic));
                }
                break;

            case setEaseType.InOutElastic:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutElastic);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutElastic));
                }
                break;

            case setEaseType.InBack:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InBack);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InBack));
                }
                break;

            case setEaseType.OutBack:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutBack);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutBack));
                }
                break;

            case setEaseType.InOutBack:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutBack);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutBack));
                }
                break;

            case setEaseType.InBounce:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InBounce);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InBounce));
                }
                break;

            case setEaseType.OutBounce:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutBounce);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutBounce));
                }
                break;

            case setEaseType.InOutBounce:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutBounce);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutBounce));
                }
                break;

            case setEaseType.Flash:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.Flash);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.Flash));
                }
                break;

            case setEaseType.InFlash:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InFlash);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InFlash));
                }
                break;

            case setEaseType.OutFlash:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutFlash);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutFlash));
                }
                break;

            case setEaseType.InOutFlash:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutFlash);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutFlash));
                }
                break;


            case setEaseType.AnimationCurve:
                setFinal.SetEase(animationCurve.curve);
                break;
            }

            // Update + TimeScale

            switch (updateTypeSelect)
            {
            case updateType.Normal:
                setFinal.SetUpdate(UpdateType.Normal, isTimeIndependent.Value);
                break;

            case updateType.Fixed:
                setFinal.SetUpdate(UpdateType.Fixed, isTimeIndependent.Value);
                break;

            case updateType.Late:
                setFinal.SetUpdate(UpdateType.Late, isTimeIndependent.Value);
                break;
            }



            // Easy part to edit for other DotTween actions --->

            switch (dotweenTypeSelect)
            {
            case doTweenType.doAspect:
                _target.GetComponent <Camera>().DOAspect(to.Value, duration.Value).SetAs(setFinal);
                break;

            case doTweenType.farClipPlane:
                _target.GetComponent <Camera>().DOFarClipPlane(to.Value, duration.Value).SetAs(setFinal);
                break;

            case doTweenType.fieldOfView:
                _target.GetComponent <Camera>().DOFieldOfView(to.Value, duration.Value).SetAs(setFinal);
                break;

            case doTweenType.nearClipPlane:
                _target.GetComponent <Camera>().DONearClipPlane(to.Value, duration.Value).SetAs(setFinal);
                break;

            case doTweenType.orthographicSize:
                _target.GetComponent <Camera>().DOOrthoSize(to.Value, duration.Value).SetAs(setFinal);
                break;
            }



            // <---


            if (startEvent != null)
            {
                Fsm.Event(startEvent);
                Finish();
            }
        }
Exemple #3
0
        public override void OnEnter()
        {
            if (duration.Value == 0)
            {
                Debug.LogWarning("<b>[DotweenPunchTransformTo]</b><color=#FF9900ff>!!! Duration cannot be 0 !!! </color>", this.Owner);
                Finish();
            }
            var _target = Fsm.GetOwnerDefaultTarget(gameObject);

            if (_target != null)
            {
                Vector3 Vector3setup = to.IsNone ? new Vector3(x.Value, y.Value, z.Value) : to.Value;

                if (!x.IsNone)
                {
                    Vector3setup.x = x.Value;
                }
                if (!y.IsNone)
                {
                    Vector3setup.y = y.Value;
                }
                if (!z.IsNone)
                {
                    Vector3setup.z = z.Value;
                }

                to.Value = Vector3setup;
            }

            if (elasticity.Value > 1f)
            {
                elasticity.Value = 1;
            }
            if (elasticity.Value < 0f)
            {
                elasticity.Value = 0;
            }

            if (loopDontFinish.Value == true)
            {
                settingLoops = -1;
            }
            else
            {
                settingLoops = loopsQuantity.Value;
            }


            if (toObject.Value != null)
            {
                var go = toObject.Value;
                to.Value = go.transform.position;
            }

            setFinal = new TweenParams().SetDelay(setDelay.Value).SetAutoKill(setAutoKill.Value).SetSpeedBased(isSpeedBased.Value).SetRelative(setRelative.Value).OnComplete(MyCallback);



            switch (loopTypeSelect)
            {
            case loopType.None:
                if (settingLoops > 0 || settingLoops < 0)
                {
                    Debug.LogWarning("<b>[DotweenPunchTransformTo]</b><color=#FF9900ff>!!! Loop Time is set but no 'Loop Type' is selected !!! </color>\",this.Owner");
                }
                break;

            case loopType.Yoyo:
                setFinal.SetLoops(settingLoops, LoopType.Yoyo);
                break;

            case loopType.Restart:
                setFinal.SetLoops(settingLoops, LoopType.Restart);
                break;

            case loopType.Incremental:
                setFinal.SetLoops(settingLoops, LoopType.Incremental);
                break;
            }



            if (!tag.IsNone)
            {
                setFinal.SetId(tag.Value);
            }
            bool _isNullOrEmpty = orInputID.IsNone || orInputID == null || string.IsNullOrEmpty(orInputID.Value);

            if (_isNullOrEmpty == false)
            {
                setFinal.SetId(orInputID.Value);
            }
            bool obj_isNullOrEmpty = gameObjectId.IsNone || gameObjectId.Value == false;

            if (obj_isNullOrEmpty == false)
            {
                setFinal.SetId(Fsm.GetOwnerDefaultTarget(gameObject));
            }


            switch (easeTypeSelect)
            {
            case setEaseType.none:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.Linear);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.Linear));
                }
                break;

            case setEaseType.InSine:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InSine);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InSine));
                }
                break;

            case setEaseType.OutSine:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutSine);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutSine));
                }
                break;

            case setEaseType.InOutSine:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutSine);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutSine));
                }
                break;

            case setEaseType.InQuad:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InQuad);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InQuad));
                }
                break;

            case setEaseType.OutQuad:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutQuad);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutQuad));
                }
                break;

            case setEaseType.InOutQuad:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutQuad);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutQuad));
                }
                break;

            case setEaseType.InCubic:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InCubic);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InCubic));
                }
                break;

            case setEaseType.OutCubic:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutCubic);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutCubic));
                }
                break;

            case setEaseType.InOutCubic:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutCubic);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutCubic));
                }
                break;

            case setEaseType.InQuart:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InQuart);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InQuart));
                }
                break;

            case setEaseType.OutQuart:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutQuart);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutQuart));
                }
                break;

            case setEaseType.InOutQuart:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutQuart);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutQuart));
                }
                break;

            case setEaseType.InQuint:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InQuint);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InQuint));
                }
                break;

            case setEaseType.OutQuint:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutQuint);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutQuint));
                }
                break;

            case setEaseType.InOutQuint:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutQuint);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutQuint));
                }
                break;

            case setEaseType.InExpo:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InExpo);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InExpo));
                }
                break;

            case setEaseType.OutExpo:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutExpo);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutExpo));
                }
                break;

            case setEaseType.InOutExpo:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutExpo);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutExpo));
                }
                break;

            case setEaseType.InCirc:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InCirc);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InCirc));
                }
                break;

            case setEaseType.OutCirc:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutCirc);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutCirc));
                }
                break;

            case setEaseType.InOutCirc:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutCirc);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutCirc));
                }
                break;

            case setEaseType.InElastic:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InElastic);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InElastic));
                }
                break;

            case setEaseType.OutElastic:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutElastic);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutElastic));
                }
                break;

            case setEaseType.InOutElastic:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutElastic);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutElastic));
                }
                break;

            case setEaseType.InBack:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InBack);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InBack));
                }
                break;

            case setEaseType.OutBack:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutBack);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutBack));
                }
                break;

            case setEaseType.InOutBack:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutBack);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutBack));
                }
                break;

            case setEaseType.InBounce:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InBounce);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InBounce));
                }
                break;

            case setEaseType.OutBounce:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutBounce);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutBounce));
                }
                break;

            case setEaseType.InOutBounce:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutBounce);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutBounce));
                }
                break;

            case setEaseType.Flash:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.Flash);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.Flash));
                }
                break;

            case setEaseType.InFlash:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InFlash);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InFlash));
                }
                break;

            case setEaseType.OutFlash:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.OutFlash);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.OutFlash));
                }
                break;

            case setEaseType.InOutFlash:
                if (enableEaseFactory.Value == false)
                {
                    setFinal.SetEase(Ease.InOutFlash);
                }
                if (enableEaseFactory.Value == true)
                {
                    setFinal.SetEase(EaseFactory.StopMotion(easeFactoryFps.Value, Ease.InOutFlash));
                }
                break;

            case setEaseType.AnimationCurve:
                setFinal.SetEase(animationCurve.curve);
                break;
            }


            // Update + TimeScale
            switch (updateTypeSelect)
            {
            case updateType.Normal:
                setFinal.SetUpdate(UpdateType.Normal, isTimeIndependent.Value);
                break;

            case updateType.Fixed:
                setFinal.SetUpdate(UpdateType.Fixed, isTimeIndependent.Value);
                break;

            case updateType.Late:
                setFinal.SetUpdate(UpdateType.Late, isTimeIndependent.Value);
                break;
            }


            // Easy part to edit for other DotTween actions --->

            switch (dotweenTypeSelect)
            {
            case doTweenType.DoPunchPosition:
                _target.transform.DOPunchPosition(to.Value, duration.Value, vibrato.Value, elasticity.Value, snapping.Value).SetAs(setFinal);
                break;

            case doTweenType.DoPunchRotation:
                _target.transform.DOPunchRotation(to.Value, duration.Value, vibrato.Value, elasticity.Value).SetAs(setFinal);
                break;

            case doTweenType.DoPunchScale:
                _target.transform.DOPunchScale(to.Value, duration.Value, vibrato.Value, elasticity.Value).SetAs(setFinal);
                break;
            }

            // <---


            if (startEvent != null)
            {
                Fsm.Event(startEvent);
                Finish();
            }
        }