支持先加入实体后加入系统以让matcher进行实体匹配/优化行为树节点效果及逻辑
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
// 子类可以重写此方法进行额外初始化
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user