示例#1
0
    private void GoBackToPlayer()
    {
        if (sequence != null)
        {
            sequence.Kill();
        }

        float perc     = Vector3.Distance(bottomPosition, transform.position) / Vector3.Distance(bottomPosition, playerFishingRod.hookPosition.transform.position);
        float newSpeed = (1 - perc) * cableSpeed;

        sequence = DOTween.Sequence();
        sequence.Append(transform.DOMoveY(playerFishingRod.transform.position.y, newSpeed).SetEase(Ease.Linear)).AppendCallback((() => playerFishingRod.CancelFishingRod(hookedObject)));
    }