fix(hero view): 清理英雄节点残留特效子节点
修复对象池复用英雄节点时,残留上一个单位的特效到新单位的问题
This commit is contained in:
@@ -544,6 +544,15 @@ export class HeroViewComp extends CCComp {
|
||||
// 清理残留的定时器和缓动
|
||||
this.unscheduleAllCallbacks();
|
||||
Tween.stopAllByTarget(this.node);
|
||||
// 清理挂在节点下未播完的特效子节点(冰冻/击晕/受击等),
|
||||
// 防止对象池复用节点时把上一个单位的特效带到新单位身上。
|
||||
// 判定依据:特效由 spawnTimedFx/spawnAnimEndFx 实例化并挂 timedCom/oneCom,
|
||||
// 预制体自带子节点(anm/top 等)无这两个组件,不受影响。
|
||||
for (const child of [...this.node.children]) {
|
||||
if (child.getComponent(timedCom) || child.getComponent(oneCom)) {
|
||||
child.destroy();
|
||||
}
|
||||
}
|
||||
this.topBar.reset();
|
||||
|
||||
// 清理碰撞器事件监听
|
||||
|
||||
Reference in New Issue
Block a user