Files
esengine/source/src/ECS/Systems/EntitySystem.ts

52 lines
885 B
TypeScript
Raw Normal View History

2020-06-08 18:26:05 +08:00
class EntitySystem {
private _scene: Scene;
private _entities: Entity[] = [];
private _matcher: Matcher;
public get matcher(){
return this._matcher;
}
public get scene(){
return this._scene;
}
public set scene(value: Scene){
this._scene = value;
this._entities = [];
}
constructor(matcher?: Matcher){
this._matcher = matcher ? matcher : Matcher.empty();
}
public initialize(){
}
public update(){
this.begin();
this.process(this._entities);
}
public lateUpdate(){
this.lateProcess(this._entities);
this.end();
}
protected begin(){
}
protected process(entities: Entity[]){
}
protected lateProcess(entities: Entity[]){
}
protected end(){
}
}