Fixed frontend animation switch after atk and stun.

This commit is contained in:
genxium 2022-11-25 22:26:15 +08:00
parent 695eacaabc
commit fa491b357d
2 changed files with 5 additions and 1 deletions

View File

@ -454,7 +454,7 @@
"array": [
0,
0,
217.09900263394968,
210.4441731196186,
0,
0,
0,

View File

@ -59,6 +59,9 @@ cc.Class({
if (newCharacterState != prevCharacterState) {
if (newAnimName == this.animComp.animationName) {
if (ATK_CHARACTER_STATE.Idle1[0] == newCharacterState || ATK_CHARACTER_STATE.Walking[0] == newCharacterState) {
if (false == this.animComp._playing) {
this.animComp.playAnimation(newAnimName);
}
// No need to interrupt
// console.warn(`JoinIndex=${rdfPlayer.joinIndex}, not interrupting ${newAnimName} while the playing anim is also ${this.animComp.animationName}, player rdf changed from: ${null == prevRdfPlayer ? null : JSON.stringify(prevRdfPlayer)}, , to: ${JSON.stringify(rdfPlayer)}`);
return;
@ -71,6 +74,7 @@ cc.Class({
// the playing animation was falsely predicted
this._interruptPlayingAnimAndPlayNewAnim(rdfPlayer, prevRdfPlayer, newCharacterState, newAnimName);
}
// TODO: What if (newAnimName == this.animComp.animationName) but (false == this.animComp._playing) by now? Do we just force it to play from beginning or use "this._interruptPlayingAnimAndPlayNewAnim"?
}
},