新增DelayedIteratingSystem/IntervalSystem/IntervalIteratingSystem

This commit is contained in:
yhh
2021-01-27 14:58:51 +08:00
parent 4f7cfb087a
commit 1c9276b4a1
12 changed files with 727 additions and 131 deletions

View File

@@ -1,24 +0,0 @@
module es {
export class ComponentPool<T extends PooledComponent> {
private _cache: T[];
private _type: any;
constructor(typeClass: any) {
this._type = typeClass;
this._cache = [];
}
public obtain(): T {
try {
return this._cache.length > 0 ? this._cache.shift() : new this._type();
} catch (err) {
throw new Error(this._type + err);
}
}
public free(component: T) {
component.reset();
this._cache.push(component);
}
}
}

View File

@@ -1,6 +0,0 @@
module es {
/** 回收实例的组件类型。 */
export abstract class PooledComponent extends Component {
public abstract reset();
}
}