伤害系统有问题,打算放弃
This commit is contained in:
24
assets/script/game/battle/BattleEndSystem.ts
Normal file
24
assets/script/game/battle/BattleEndSystem.ts
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user