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