我在设计这个单位的开火的时候,发现他的开火动画有时候会跑偏
下面是正常情况
下面是异常情况
我个人怀疑是因为动画播放的图中 单位有移动 然后图像就定个在一个位置了
解决方案就是重新载入一下图像就好
/**播放开火动作 */
PlayFireAnimation() {
if (this.ShotFireAnimation.length > 0) {
for (let i of this.ShotFireAnimation) {
i.node.getComponent(Sprite).enabled = false
i.node.getComponent(Sprite).enabled = true
let name = i.clips[0].name
i.stop()
i.play()
}
}
}
解决完毕!