@ue-too/ecs / index / System
インターフェイス: System
定義: index.ts:1154
System interface for processing entities with specific component combinations.
Remarks
A System maintains a set of entities that match its component signature. The ECS automatically updates this set when entities are created, destroyed, or have their components modified.
Systems contain only the logic for processing entities - the entities set is automatically managed by the SystemManager.
例
typescript
const Position = createComponentName('Position');
const Velocity = createComponentName('Velocity');
const movementSystem: System = {
entities: new Set()
};
// System logic (called in game loop)
function updateMovement(deltaTime: number) {
movementSystem.entities.forEach(entity => {
const pos = ecs.getComponentFromEntity<Position>(Position, entity);
const vel = ecs.getComponentFromEntity<Velocity>(Velocity, entity);
if (pos && vel) {
pos.x += vel.x * deltaTime;
pos.y += vel.y * deltaTime;
}
});
}プロパティ
entities
entities:
Set<number>
定義: index.ts:1155