This commit is contained in:
shurongsen 2024-12-04 06:08:11 +08:00
parent 5ce54b749f
commit 9a519a9df0

View File

@ -74,27 +74,24 @@ public class Role : Fun
{
while (true)
{
//if (AnimationTree.Count == 0)
//{
// isAnimationPlay = false;
// return;
//}
//isAnimationPlay = true;
if (animationHighlight > AnimationTree.Count)
if (AnimationTree.Count == 0)
{
isAnimationPlay = false;
return;
}
isAnimationPlay = true;
if (animationHighlight >= AnimationTree.Count)
{
animationHighlight = AnimationTree.Count - 1;
Debug.Log("=---");
}
else if (animationHighlight < 0) {
animationHighlight = 0;
}
EditorUtility.SetDirty(this);
Debug.Log(animationHighlight > AnimationTree.Count);
Debug.Log(animationHighlight);
List<Sprite> LightSprite = AnimationTree[animationHighlight].value;
if (LightSprite == null )
{
//isAnimationPlay = false;
isAnimationPlay = false;
return;
};
OnAnimationStart?.Invoke(animationHighlight);
@ -108,7 +105,7 @@ public class Role : Fun
{
spriteRenderer.sprite = sprite;
}
if (animationHighlight > 0 && animationHighlight < AnimationTree.Count)
if (animationHighlight >= 0 && animationHighlight < AnimationTree.Count)
{
OnAnimationIng?.Invoke(animationHighlight);
await Task.Delay(AnimationTree[animationHighlight].CharacterAnimationFrameInterval);
@ -166,10 +163,10 @@ public class Role : Fun
// 如果启用 MonoBehaviour则每个固定帧速率的帧都将调用此函数
private void FixedUpdate()
{
//if (!isAnimationPlay)
//{
// updateAnimation();
//}
if (!isAnimationPlay)
{
updateAnimation();
}
}