diff --git a/assets/script/game/common/SingletonModuleComp.ts b/assets/script/game/common/SingletonModuleComp.ts index 7adbc08a..58b30ff6 100644 --- a/assets/script/game/common/SingletonModuleComp.ts +++ b/assets/script/game/common/SingletonModuleComp.ts @@ -65,6 +65,7 @@ export class SingletonModuleComp extends ecs.Comp { max_mission:4,//最大关卡 coin:0, time:15*60,//游戏时间 + score:0, }, hero:{ name:'', diff --git a/assets/script/game/common/config/GameEvent.ts b/assets/script/game/common/config/GameEvent.ts index d8543afa..a98d496f 100644 --- a/assets/script/game/common/config/GameEvent.ts +++ b/assets/script/game/common/config/GameEvent.ts @@ -63,4 +63,5 @@ export enum GameEvent { GOLD_UPDATE = "GOLD_UPDATE", DIAMOND_UPDATE = "DIAMOND_UPDATE", MEAT_UPDATE = "MEAT_UPDATE", + ReviveSuccess = "ReviveSuccess", } \ No newline at end of file diff --git a/assets/script/game/hero/HeroViewComp.ts b/assets/script/game/hero/HeroViewComp.ts index 3551a4ca..a220b614 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -74,7 +74,6 @@ export class HeroViewComp extends CCComp { onLoad() { this.as = this.getComponent(HeroSpine); //console.log("[HeroViewComp]:hero view comp ",this.FIGHTCON) - this.on(GameEvent.FightEnd,this.do_fight_end,this) const collider = this.node.getComponent(BoxCollider2D); this.scheduleOnce(()=>{ if (collider) { @@ -308,9 +307,7 @@ export class HeroViewComp extends CCComp { // 注意:BaseUp 逻辑已移到 HeroAttrSystem.update() // 注意:updateTemporaryBuffsDebuffs 逻辑已移到 HeroAttrSystem.update() - do_fight_end(){ - this.as.do_buff() - } + get isActive() { return this.ent.has(HeroViewComp) && this.node?.isValid; } @@ -418,9 +415,12 @@ export class HeroViewComp extends CCComp { if(this.model.fac === FacSet.HERO){ // 英雄死亡:延迟触发死亡事件 - oops.message.dispatchEvent(GameEvent.HeroDead, { - hero_uuid: this.model.hero_uuid - }); + // 🔥 只有主角死亡才触发游戏结束判定 + if (this.model.is_master) { + oops.message.dispatchEvent(GameEvent.HeroDead, { + hero_uuid: this.model.hero_uuid + }); + } } // 根据阵营触发不同事件 if(this.model.fac === FacSet.MON){