refactor(battle): 重构战斗目标查找与位置管理逻辑
新增全局位置网格系统,用于按索引存储敌我单位实体ID: - 在SingletonModuleComp添加heroGrid与monGrid数组 - 为HeroAttrsComp新增posIndex字段记录位置索引并初始化 优化战斗核心流程: - 重构MissionHeroComp的位置选择逻辑,拆分方法返回位置索引而非直接坐标,优化位置占用检测 - 重构SCastSystem的目标查找与收集逻辑,改用网格遍历替代全量实体查询,大幅提升性能 - 统一三路单位的查找优先级,简化代码提升可维护性 - 完善Hero与Monster的创建销毁流程,同步更新网格的单位注册与注销信息
This commit is contained in:
@@ -45,6 +45,8 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
in_select: false,
|
||||
in_fight: false,
|
||||
stop_mon_action: false,
|
||||
heroGrid: [-1, -1, -1, -1, -1, -1],
|
||||
monGrid: [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1],
|
||||
};
|
||||
finish_guides: number[] = [0]
|
||||
data: any = {
|
||||
|
||||
Reference in New Issue
Block a user