feat(英雄系统): 添加英雄复活机制并控制怪物行为

实现英雄复活功能,当英雄死亡且有复活次数时延迟复活
新增is_reviving状态标记复活中状态
英雄死亡或复活时通过stop_mon_action控制怪物停止刷新和移动
This commit is contained in:
walkpan
2026-01-03 11:17:04 +08:00
parent 56452795bb
commit 1cce4ce361
11 changed files with 88 additions and 11 deletions

View File

@@ -317,7 +317,7 @@ export class HeroViewComp extends CCComp {
/** 状态切换(动画) */
status_change(type:string){
this.status = type;
if(this.model.is_dead) return
if(this.model.is_dead || this.model.is_reviving) return
if(type === "idle"){
this.as.idle();
} else if(type === "move"){
@@ -351,14 +351,34 @@ export class HeroViewComp extends CCComp {
}
alive(){
// 重置复活标记 - 必须最先重置否则status_change会被拦截
this.model.is_reviving = false;
this.model.is_dead=false
this.model.is_count_dead=false
this.as.do_buff();
this.status_change("idle");
this.model.hp =this.model.Attrs[Attrs.HP_MAX]*50/100;
this.top_node.active=false
this.lastBarUpdateTime=0
// 恢复怪物行动
if (this.model.fac === FacSet.HERO) {
smc.mission.stop_mon_action = false;
console.log("[HeroViewComp] Hero revived, resuming monster action");
}
}
/**
* 调度复活逻辑
* @param delay 延迟时间(秒)
*/
scheduleRevive(delay: number) {
this.scheduleOnce(() => {
this.alive();
}, delay);
}
/**
* 死亡视图表现
* 由 HeroAtkSystem 调用,只负责视觉效果和事件通知