fix: 收敛战斗内存增长并强化战斗结束清理
This commit is contained in:
@@ -25,9 +25,16 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
debugMode: boolean = false; // 是否启用调试模式
|
||||
private readonly emptyCastPlan = { skillId: 0, isFriendly: false, targetPos: null as Vec3 | null, targetEids: [] as number[] };
|
||||
private readonly meleeCastRange = 64;
|
||||
private heroMatcher: ecs.IMatcher | null = null;
|
||||
private getHeroMatcher(): ecs.IMatcher {
|
||||
if (!this.heroMatcher) {
|
||||
this.heroMatcher = ecs.allOf(HeroAttrsComp, HeroViewComp);
|
||||
}
|
||||
return this.heroMatcher;
|
||||
}
|
||||
|
||||
filter(): ecs.IMatcher {
|
||||
return ecs.allOf(HeroAttrsComp, HeroViewComp);
|
||||
return this.getHeroMatcher();
|
||||
}
|
||||
|
||||
update(e: ecs.Entity): void {
|
||||
@@ -181,7 +188,7 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
const currentX = heroView.node.position.x;
|
||||
let nearest: HeroViewComp | null = null;
|
||||
let minDist = Infinity;
|
||||
ecs.query(this.filter()).forEach(entity => {
|
||||
ecs.query(this.getHeroMatcher()).forEach(entity => {
|
||||
const attrs = entity.get(HeroAttrsComp);
|
||||
const view = entity.get(HeroViewComp);
|
||||
if (!attrs || !view?.node) return;
|
||||
|
||||
Reference in New Issue
Block a user