支持先加入实体后加入系统以让matcher进行实体匹配/优化行为树节点效果及逻辑

This commit is contained in:
YHH
2025-06-19 15:00:14 +08:00
parent 8c86d6b696
commit 310f5f2349
22 changed files with 1809 additions and 84 deletions

View File

@@ -3,7 +3,7 @@ import { Core } from '../../Core';
import { Matcher } from '../Utils/Matcher';
import { PerformanceMonitor } from '../../Utils/PerformanceMonitor';
import type { Scene } from '../Scene';
import type { ISystemBase } from '../../Types';
import type { ISystemBase } from '../../types';
/**
* 实体系统的基类
@@ -115,10 +115,17 @@ export abstract class EntitySystem implements ISystemBase {
/**
* 系统初始化
*
* 在系统创建时调用,子类可以重写此方法进行初始化操作
* 在系统创建时调用,自动检查场景中已存在的实体是否匹配此系统
* 子类可以重写此方法进行额外的初始化操作。
*/
public initialize(): void {
// 子类可以重写此方法
if (this.scene?.entities?.buffer) {
for (const entity of this.scene.entities.buffer) {
this.onChanged(entity);
}
}
// 子类可以重写此方法进行额外初始化
}
/**