예제 #1
0
파일: Kone.cs 프로젝트: inonoa/tekiyoke2
    void Jump(Vector2 heroPos)
    {
        Vector2 targetPos  = transform.position.ToVec2() + new Vector2(0, firstJumpHeight);
        Vector2 thisToHero = heroPos - targetPos;

        transform.rotation = Quaternion.FromToRotation(Vector3.down, thisToHero);

        Vector2 nextHeroPos = heroPos;

        rigidBody
        .DOMoveY(firstJumpHeight, firstJumpDuration)
        .SetRelative()
        .SetEase(firstJumpEase)
        .onComplete += () =>
        {
            DOVirtual.DelayedCall(firstJumpToAttack, () => Attack(nextHeroPos));
        };

        DOVirtual.DelayedCall(lookAtHeroDelay, () =>
        {
            nextHeroPos             = HeroDefiner.CurrentPos.ToVec2();
            Vector2 thisToHeroFinal = nextHeroPos - targetPos;
            float targetRot         = Quaternion.FromToRotation(Vector3.down, thisToHeroFinal).eulerAngles.z;
            rigidBody.DOMyRotate(targetRot, lookAtHeroDuration, false).SetEase(Ease.InOutSine);
        });
    }
예제 #2
0
    public override Tween GetTween(UniTween.UniTweenTarget uniTweenTarget)
    {
        Rigidbody2D rb = (Rigidbody2D)GetComponent(uniTweenTarget);

        switch (command)
        {
        case Rigidbody2DCommand.Move:
            return(rb.DOMove(vector2, duration, snapping));

        case Rigidbody2DCommand.MoveX:
            return(rb.DOMoveX(to, duration, snapping));

        case Rigidbody2DCommand.MoveY:
            return(rb.DOMoveY(to, duration, snapping));

        case Rigidbody2DCommand.Jump:
            return(rb.DOJump(vector2, jumpPower, numJumps, duration, snapping));

        case Rigidbody2DCommand.Rotate:
            return(rb.DORotate(to, duration));

        default:
            return(null);
        }
    }
예제 #3
0
    IEnumerator Start()
    {
        yield return(new WaitForSeconds(1f));

        bossBody.DOMoveY(8.4f, 5f).SetRelative();

        /* s = DOTween.Sequence();
         * s.Append(bossBody.DOMoveX(4f, 5f).SetRelative());
         * s.Append(bossBody.DOMoveX(-8f, 10f).SetRelative());
         * s.Append(bossBody.DOMoveX(4f, 5f).SetRelative());
         * s.SetLoops(-1, LoopType.Restart); */
    }
예제 #4
0
    void OnSpawned()
    {
        RigidBody = transform.Find("Kasa").GetComponent <Rigidbody2D>();

        view = GetComponent <JellyView>();
        view.Init(isGoingUp);

        float posU     = positionU.position.y;
        float posD     = positionD.position.y;
        float diameter = posU - posD;

        Tween firstTween = RigidBody.DOMoveY(isGoingUp ? posU : posD, periodSecs)
                           .SetEase(Ease.InOutSine);

        firstTween.GetPausable().AddTo(this);

        float currentTimeNormalized = Mathf.InverseLerp
                                      (
            isGoingUp ? posD : posU,
            isGoingUp ? posU : posD,
            RigidBody.position.y
                                      );
        float currentTime = (1 - Mathf.Acos(currentTimeNormalized)) * periodSecs;

        firstTween.Goto(currentTime, andPlay: true);

        firstTween.OnComplete(() =>
        {
            Turn();

            Tween mainTween = RigidBody
                              .DOMoveY(isGoingUp ? posU : posD, periodSecs)
                              .SetEase(Ease.InOutSine)
                              .SetLoops(-1, LoopType.Yoyo)
                              .OnStepComplete(() => Turn());

            mainTween.GetPausable().AddTo(this);
        });
    }
예제 #5
0
        /// <summary>
        /// Creates and returns a Tween for the informed component.
        /// The Tween is configured based on the attribute values of this TweenData file.
        /// </summary>
        /// <param name="transform"></param>
        /// <returns></returns>
        public Tween GetTween(Rigidbody2D rb)
        {
            switch (command)
            {
            case Rigidbody2DCommand.Move:
                return(rb.DOMove(vector2, duration, snapping));

            case Rigidbody2DCommand.MoveX:
                return(rb.DOMoveX(to, duration, snapping));

            case Rigidbody2DCommand.MoveY:
                return(rb.DOMoveY(to, duration, snapping));

            case Rigidbody2DCommand.Jump:
                return(rb.DOJump(vector2, jumpPower, numJumps, duration, snapping));

            case Rigidbody2DCommand.Rotate:
                return(rb.DORotate(to, duration));

            default:
                return(null);
            }
        }
예제 #6
0
        public override void OnEnter()
        {
            var _target = Fsm.GetOwnerDefaultTarget(gameObject);

            if (_target != null)
            {
                Vector2 Vector2setup = to.IsNone ? new Vector2(x.Value, y.Value) : to.Value;

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

                to.Value = Vector2setup;
            }

            rigidBody = _target.GetComponent <Rigidbody2D>();

            if (rigidBody == null)
            {
                Debug.LogWarning("<b>[DotweenJumpRigidbody2dTo]</b><color=#FF9900ff>Missing Rigidbody component</color>", this.Owner);
                return;
            }

            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>[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.DoMove:
                rigidBody.DOMove(to.Value, duration.Value, snapping.Value).SetAs(setFinal);
                break;

            case doTweenType.DoMoveX:
                float x = to.Value.x;
                rigidBody.DOMoveX(x, duration.Value, snapping.Value).SetAs(setFinal);
                break;

            case doTweenType.DoMoveY:
                float y = to.Value.y;
                rigidBody.DOMoveY(y, duration.Value, snapping.Value).SetAs(setFinal);
                break;
            }

            // <---


            if (startEvent != null)
            {
                Fsm.Event(startEvent);
                Finish();
            }
        }
 public static Tweener DOMoveY(this Rigidbody2D target, Position1DTweenConfig c)
 {
     return(target.DOMoveY(c.To, c.Duration, c.Snapping));
 }
 private void ArrowMovement()
 {
     //RB2D.velocity = new Vector2 (0f, throwSpeed * Time.deltaTime);
     //transform.DOMoveY (throwSpeed * Time.deltaTime, 0.25f).SetEase (Ease.InElastic);
     RB2D.DOMoveY(4, .8f).SetEase(Ease.InOutExpo);
 }