예제 #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);
        });
    }