修复动画过程中隐藏物体导致动画卡住的bug
This commit is contained in:
parent
3a21aa5c83
commit
c94dd81f4c
@ -27,6 +27,8 @@ namespace QFramework
|
|||||||
string frame;
|
string frame;
|
||||||
string speed;
|
string speed;
|
||||||
string deviceName;
|
string deviceName;
|
||||||
|
|
||||||
|
float totalTime;
|
||||||
public static AnimationAction Allocate(string path, Dictionary<string, string> datas, System.Action OnFinished = null)
|
public static AnimationAction Allocate(string path, Dictionary<string, string> datas, System.Action OnFinished = null)
|
||||||
{
|
{
|
||||||
var retNode = mPool.Allocate();
|
var retNode = mPool.Allocate();
|
||||||
@ -95,16 +97,13 @@ namespace QFramework
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
anim[animName].speed = curSpeed;
|
anim[animName].speed = curSpeed;
|
||||||
|
|
||||||
anim.Play(animName);
|
anim.Play(animName);
|
||||||
|
|
||||||
if (anim[animName].wrapMode == WrapMode.Loop)
|
if (anim[animName].wrapMode == WrapMode.Loop)
|
||||||
{
|
{
|
||||||
this.Finish();
|
this.Finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
totalTime = Math.Abs(anim[animName].length / curSpeed);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
@ -122,7 +121,8 @@ namespace QFramework
|
|||||||
|
|
||||||
public void OnExecute(float dt)
|
public void OnExecute(float dt)
|
||||||
{
|
{
|
||||||
if (anim != null && anim.isPlaying == false)
|
totalTime -= Time.deltaTime;
|
||||||
|
if (anim != null && (anim.isPlaying == false || totalTime <= 0))
|
||||||
{
|
{
|
||||||
this.Finish();
|
this.Finish();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user