fix(战斗系统): 修复角色状态切换和击退效果的问题

- 在HeroMove和MonMove系统中增加攻击状态检查,避免攻击时被错误切换为待机状态
- 为HeroAtkSystem添加受击者击退效果
- 优化HeroViewComp的击退逻辑,包括英雄和怪物,并修复重复触发问题
- 修复怪物死亡后状态切换问题
This commit is contained in:
walkpan
2026-01-03 13:41:08 +08:00
parent 1cce4ce361
commit 08c153ee5d
4 changed files with 34 additions and 13 deletions

View File

@@ -41,12 +41,18 @@ export class MonMoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpda
update(e: ecs.Entity) {
if (!smc.mission.play || smc.mission.pause) return;
const view = e.get(HeroViewComp);
// 如果英雄死亡停止怪物行动标志为true则停止怪物移动
if (smc.mission.stop_mon_action) return;
if (smc.mission.stop_mon_action) {
view.status_change("idle");
return;
}
const move = e.get(MonMoveComp);
const model = e.get(HeroAttrsComp);
const view = e.get(HeroViewComp);
// const view = e.get(HeroViewComp);
// 只处理怪物
if (model.fac !== FacSet.MON) return;
@@ -91,7 +97,9 @@ export class MonMoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpda
move.moving = false;
}
} else {
view.status_change("idle");
if (!model.is_atking) {
view.status_change("idle");
}
}
}