伤害系统有问题,打算放弃

This commit is contained in:
2025-02-03 15:03:45 +08:00
parent 8f2612bda2
commit 060046a6a6
18 changed files with 549 additions and 112 deletions

View File

@@ -0,0 +1,24 @@
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { BattleState } from "./BattleStateComp";
import { DamageResult } from "../damage/DamageComp";
@ecs.register('BattleEndSystem')
export class BattleEndSystem extends ecs.ComblockSystem {
filter(): ecs.IMatcher {
return ecs.allOf(BattleState);
}
update(e: ecs.Entity) {
const state = e.get(BattleState);
if (state.isEnded) {
// 清理所有残留伤害组件
ecs.query(ecs.allOf(DamageResult)).forEach(entity => {
entity.remove(DamageResult);
});
// 重置战斗状态
state.isEnded = false;
}
}
}