From b5a79921a996f85caac1a493841e3bad2532e04d Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Thu, 16 Jan 2025 18:48:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A8=E7=94=BB=E5=81=9C=E6=AD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Actions/AnimationAction.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Actions/AnimationAction.cs b/Assets/Scripts/Actions/AnimationAction.cs index edee41a5..c212e4a6 100644 --- a/Assets/Scripts/Actions/AnimationAction.cs +++ b/Assets/Scripts/Actions/AnimationAction.cs @@ -1,8 +1,11 @@ using DG.Tweening; +using DG.Tweening.Core; +using DG.Tweening.Plugins.Options; using System; using System.Collections.Generic; using UnityEngine; using UnityEngine.Rendering.Universal; +using static OperationController; namespace QFramework { @@ -45,7 +48,7 @@ namespace QFramework } public ulong ActionID { get; set; } public ActionStatus Status { get; set; } - + TweenerCore animDot; public void OnStart() { GameObject obj = null; @@ -89,7 +92,8 @@ namespace QFramework { anim.Play(animName); anim[animName].normalizedTime = 1; - DOTween.To(() => anim[animName].normalizedTime, v => anim[animName].normalizedTime = v, 0, anim[animName].length / Math.Abs(curSpeed)).onComplete = () => + animDot = DOTween.To(() => anim[animName].normalizedTime, v => anim[animName].normalizedTime = v, 0, anim[animName].length / Math.Abs(curSpeed)); + animDot.onComplete = () => { anim.Stop(); }; @@ -119,6 +123,7 @@ namespace QFramework } } + public void OnExecute(float dt) { totalTime -= Time.deltaTime; @@ -144,6 +149,8 @@ namespace QFramework { if (!Deinited) { + animDot?.Kill(); + anim?.Stop(); OnFinished = null; Deinited = true; mPool.Recycle(this);