修复动画过程中隐藏物体导致动画卡住的bug

This commit is contained in:
shenjianxing 2025-01-16 17:54:18 +08:00
parent 3a21aa5c83
commit c94dd81f4c

View File

@ -27,6 +27,8 @@ namespace QFramework
string frame;
string speed;
string deviceName;
float totalTime;
public static AnimationAction Allocate(string path, Dictionary<string, string> 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();
}