refactor(英雄系统): 移除主角特殊逻辑和怪物死亡处理
- 删除 HeroAttrsComp 中的 is_master 字段 - 简化 Hero.load() 方法签名,移除 is_master 和 is_friend 参数 - 移除 MissionComp 中的怪物死亡事件监听和奖励计算逻辑 - 移除 HeroViewComp 中主角复活时恢复怪物行动的逻辑 - 修改 HeroAtkSystem 中复活逻辑,不再区分主角 - 将 MissionHeroComp 中的 CallFriend 事件改为 CallHero,并清理事件监听 - 移除英雄死亡时停止怪物刷新的逻辑,简化阵营判断 这些更改旨在简化英雄系统架构,消除主角与普通英雄之间的特殊处理差异,使系统更加统一和可维护。怪物死亡奖励计算等逻辑被移至其他系统处理。
This commit is contained in:
@@ -386,12 +386,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.model.hp =this.model.hp_max*50/100;
|
||||
this.top_node.active=false
|
||||
this.lastBarUpdateTime=0
|
||||
|
||||
// 恢复怪物行动
|
||||
if (this.model.is_master) {
|
||||
smc.mission.stop_mon_action = false;
|
||||
mLogger.log(this.debugMode, 'HeroViewComp', "[HeroViewComp] Hero revived, resuming monster action");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -434,28 +429,21 @@ export class HeroViewComp extends CCComp {
|
||||
mLogger.warn(this.debugMode, 'HeroViewComp', "[HeroViewComp] realDead called but model is null, skipping");
|
||||
return;
|
||||
}
|
||||
// 根据阵营触发不同事件
|
||||
if(this.model.fac === FacSet.MON){
|
||||
|
||||
}
|
||||
|
||||
if(this.model.fac === FacSet.HERO){
|
||||
// 英雄死亡:延迟触发死亡事件
|
||||
// 🔥 只有主角死亡才触发游戏结束判定
|
||||
if (this.model.is_master) return
|
||||
|
||||
}
|
||||
|
||||
// 🔥 方案B:治理性措施 - 在销毁实体前先禁用碰撞体,从源头减少"尸体"参与碰撞
|
||||
const collider = this.getComponent(Collider2D);
|
||||
if (collider) {
|
||||
collider.enabled = false;
|
||||
}
|
||||
|
||||
|
||||
// 根据阵营触发不同事件
|
||||
if(this.model.fac === FacSet.MON){
|
||||
oops.message.dispatchEvent(GameEvent.MonDead, {
|
||||
uuid: this.model.hero_uuid,
|
||||
lv: this.model.lv,
|
||||
is_boss: this.model.is_boss,
|
||||
is_elite: this.model.is_big_boss, // 暂时映射 is_big_boss 为 elite,或者由 MissionComp 二次判断
|
||||
position: this.node.position
|
||||
});
|
||||
}
|
||||
this.ent.destroy();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user