新增基础实体系统

This commit is contained in:
yhh
2020-06-08 18:26:05 +08:00
parent 7939253622
commit 57efc5b0e6
18 changed files with 551 additions and 28 deletions

View File

@@ -0,0 +1,52 @@
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(){
}
}