支持先加入实体后加入系统以让matcher进行实体匹配/优化行为树节点效果及逻辑
This commit is contained in:
@@ -7,7 +7,7 @@ import { PoolManager } from './Utils/Pool';
|
||||
import { ECSFluentAPI, createECSAPI } from './ECS/Core/FluentAPI';
|
||||
import { Scene } from './ECS/Scene';
|
||||
import { DebugReporter } from './Utils/DebugReporter';
|
||||
import { ICoreConfig, IECSDebugConfig } from './Types';
|
||||
import { ICoreConfig, IECSDebugConfig } from './types';
|
||||
|
||||
/**
|
||||
* 游戏引擎核心类
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IComponent } from '../Types';
|
||||
import type { IComponent } from '../types';
|
||||
|
||||
/**
|
||||
* 游戏组件基类
|
||||
|
||||
@@ -6,8 +6,6 @@ import { ComponentIndexManager, IndexType } from './ComponentIndex';
|
||||
import { ArchetypeSystem } from './ArchetypeSystem';
|
||||
import { DirtyTrackingSystem, DirtyFlag } from './DirtyTrackingSystem';
|
||||
import { EventBus } from './EventBus';
|
||||
import { ECSEventType } from '../CoreEvents';
|
||||
import { IEntityEventData, IComponentEventData } from '../../Types';
|
||||
|
||||
/**
|
||||
* 实体查询构建器
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
ISystemEventData,
|
||||
ISceneEventData,
|
||||
IPerformanceEventData
|
||||
} from '../../Types';
|
||||
} from '../../types';
|
||||
import {
|
||||
TypeSafeEventSystem,
|
||||
EventListenerConfig,
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { Component } from './Component';
|
||||
import { ComponentRegistry, ComponentType } from './Core/ComponentStorage';
|
||||
import { EventBus } from './Core/EventBus';
|
||||
import { ECSEventType } from './CoreEvents';
|
||||
import { IComponentEventData } from '../Types';
|
||||
|
||||
/**
|
||||
* 实体比较器
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
// 子类可以重写此方法进行额外初始化
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
IPerformanceDebugData,
|
||||
IComponentDebugData,
|
||||
ISceneDebugData
|
||||
} from '../Types';
|
||||
} from '../types';
|
||||
import { Core } from '../Core';
|
||||
import { Time } from './Time';
|
||||
|
||||
|
||||
@@ -18,4 +18,4 @@ export * from './ECS';
|
||||
|
||||
// 工具类和类型定义
|
||||
export * from './Utils';
|
||||
export * from './Types';
|
||||
export * from './types';
|
||||
Reference in New Issue
Block a user