技能的销毁 还存在问题

This commit is contained in:
2024-08-22 17:20:13 +08:00
parent 1be37ab104
commit 6e9faca1a3
9 changed files with 177 additions and 44 deletions

View File

@@ -82,14 +82,15 @@ export class CSkillComp extends CCComp {
// console.log("CSkillComp toDestroy");
if (this.node.isValid) {
// console.log("CSkillComp.node.isValid");
setTimeout(() => {
// console.log("CSkillComp.node.destroy",this);
this.ent.destroy()
}, 10);
}
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.sd.reset()
this.cd.reset()
this.node.destroy();
}
}

View File

@@ -110,6 +110,9 @@ export class MonsterViewComp extends CCComp {
let skill = otherCollider.node.getComponent(SkillCom)!;
// console.log('onPostSolve',skill);
this.in_atked();
if(this.hp <= 0 ){
return
}
this.hp_change(skill.atk);
}
}
@@ -219,7 +222,7 @@ export class MonsterViewComp extends CCComp {
let dis = SkillSet[skill_uuid].dis;
let atk = SkillSet[skill_uuid].atk+this.atk;
let sp_name = SkillSet[skill_uuid].sp_name;
skill.load(pos,speed,dis,scale,this.node,sp_name,atk);
skill.load(pos,speed,dis,scale,this.node,sp_name,0);
}
in_act(dt: number) {