From c94dd81f4c4c39354868cdead41ba4eb532b8800 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Thu, 16 Jan 2025 17:54:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8A=A8=E7=94=BB=E8=BF=87?= =?UTF-8?q?=E7=A8=8B=E4=B8=AD=E9=9A=90=E8=97=8F=E7=89=A9=E4=BD=93=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E5=8A=A8=E7=94=BB=E5=8D=A1=E4=BD=8F=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Actions/AnimationAction.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Assets/Scripts/Actions/AnimationAction.cs b/Assets/Scripts/Actions/AnimationAction.cs index d22a624f..edee41a5 100644 --- a/Assets/Scripts/Actions/AnimationAction.cs +++ b/Assets/Scripts/Actions/AnimationAction.cs @@ -27,6 +27,8 @@ namespace QFramework string frame; string speed; string deviceName; + + float totalTime; public static AnimationAction Allocate(string path, Dictionary datas, System.Action OnFinished = null) { var retNode = mPool.Allocate(); @@ -95,16 +97,13 @@ namespace QFramework else { anim[animName].speed = curSpeed; - anim.Play(animName); - if (anim[animName].wrapMode == WrapMode.Loop) { this.Finish(); } } - - + totalTime = Math.Abs(anim[animName].length / curSpeed); } } catch (Exception) @@ -122,7 +121,8 @@ namespace QFramework public void OnExecute(float dt) { - if (anim != null && anim.isPlaying == false) + totalTime -= Time.deltaTime; + if (anim != null && (anim.isPlaying == false || totalTime <= 0)) { this.Finish(); }