public void StartFly(Vector2 fromPos, Vector2 toPos, float fromScale, float toScale) { if (_curTweener != null) { // 如有,则先停止之前的动作。 _curTweener.Kill(); } transform.position = fromPos; transform.localScale = new Vector3(fromScale, fromScale, 1); var backPos = fromPos + (fromPos - toPos) * ThrowBackLength; _curTweener = DOTween.Sequence(); // 先出现。 _curTweener.AppendCallback(() => _animator.SetTrigger("Appear")); _curTweener.AppendInterval(JumpDelay); // 向后退一下。 _curTweener.Append(transform.DOMove(backPos, ThrowBackTime)); // 同时执行跳跃和缩放两个动作。 _curTweener.AppendCallback(() => { _animator.SetTrigger("Fly"); _soundController.PlayEffect(FlySound); }); _curTweener.Append(transform.DOJump(toPos, JumpPower, 1, JumpTime)); _curTweener.Insert(JumpDelay + ThrowBackTime, transform.DOScale(new Vector3(toScale, toScale, 1), JumpTime)); // 跳跃到目标之后,爆炸。 _curTweener.AppendCallback(() => { _animator.SetTrigger("Blast"); _soundController.PlayEffect(HitSound); }); _curTweener.AppendInterval(BlastTime); _curTweener.OnComplete(() => { _curTweener = null; }); _curTweener.Play(); }