diff --git a/Role/Role.cs b/Role/Role.cs index 284907c..69aa5ef 100644 --- a/Role/Role.cs +++ b/Role/Role.cs @@ -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 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(); + } }