新增entitySystemsEnabled用于控制是否开启系统
This commit is contained in:
@@ -34,7 +34,8 @@ module es {
|
||||
this.name = name;
|
||||
this.id = Entity._idGenerator++;
|
||||
|
||||
this.componentBits = new BitSet();
|
||||
if (Core.entitySystemsEnabled)
|
||||
this.componentBits = new BitSet();
|
||||
}
|
||||
|
||||
public _isDestroyed: boolean;
|
||||
|
||||
@@ -22,7 +22,8 @@ module es {
|
||||
this.entities = new EntityList(this);
|
||||
this.renderableComponents = new RenderableComponentList();
|
||||
|
||||
this.entityProcessors = new EntityProcessorList();
|
||||
if (Core.entitySystemsEnabled)
|
||||
this.entityProcessors = new EntityProcessorList();
|
||||
|
||||
this.initialize();
|
||||
}
|
||||
@@ -136,7 +137,7 @@ module es {
|
||||
* 只有在SceneTransition请求渲染时,它才会有一个值。
|
||||
*/
|
||||
public postRender() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -86,8 +86,10 @@ module es {
|
||||
if (isIUpdatable(component))
|
||||
this._updatableComponents.remove(component);
|
||||
|
||||
this._entity.componentBits.set(ComponentTypeManager.getIndexFor(component["__proto__"]["constructor"]), false);
|
||||
this._entity.scene.entityProcessors.onComponentRemoved(this._entity);
|
||||
if (Core.entitySystemsEnabled) {
|
||||
this._entity.componentBits.set(ComponentTypeManager.getIndexFor(component["__proto__"]["constructor"]), false);
|
||||
this._entity.scene.entityProcessors.onComponentRemoved(this._entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,8 +100,10 @@ module es {
|
||||
if (isIUpdatable(component))
|
||||
this._updatableComponents.add(component);
|
||||
|
||||
this._entity.componentBits.set(ComponentTypeManager.getIndexFor(component["__proto__"]["constructor"]));
|
||||
this._entity.scene.entityProcessors.onComponentAdded(this._entity);
|
||||
if (Core.entitySystemsEnabled) {
|
||||
this._entity.componentBits.set(ComponentTypeManager.getIndexFor(component["__proto__"]["constructor"]));
|
||||
this._entity.scene.entityProcessors.onComponentAdded(this._entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,8 +127,10 @@ module es {
|
||||
if (isIUpdatable(component))
|
||||
this._updatableComponents.add(component);
|
||||
|
||||
this._entity.componentBits.set(ComponentTypeManager.getIndexFor(component["__proto__"]["constructor"]));
|
||||
this._entity.scene.entityProcessors.onComponentAdded(this._entity);
|
||||
if (Core.entitySystemsEnabled) {
|
||||
this._entity.componentBits.set(ComponentTypeManager.getIndexFor(component["__proto__"]["constructor"]));
|
||||
this._entity.scene.entityProcessors.onComponentAdded(this._entity);
|
||||
}
|
||||
|
||||
this._components.add(component);
|
||||
this._tempBufferList.push(component);
|
||||
@@ -160,8 +166,10 @@ module es {
|
||||
if (isIUpdatable(component))
|
||||
this._updatableComponents.remove(component);
|
||||
|
||||
this._entity.componentBits.set(ComponentTypeManager.getIndexFor(component["__proto__"]["constructor"]), false);
|
||||
this._entity.scene.entityProcessors.onComponentRemoved(this._entity);
|
||||
if (Core.entitySystemsEnabled) {
|
||||
this._entity.componentBits.set(ComponentTypeManager.getIndexFor(component["__proto__"]["constructor"]), false);
|
||||
this._entity.scene.entityProcessors.onComponentRemoved(this._entity);
|
||||
}
|
||||
|
||||
component.onRemovedFromEntity();
|
||||
component.entity = null;
|
||||
|
||||
@@ -144,13 +144,16 @@ module es {
|
||||
public updateLists() {
|
||||
if (this._entitiesToRemove.length > 0) {
|
||||
for (const entity of this._entitiesToRemove) {
|
||||
// 处理标签列表
|
||||
this.removeFromTagList(entity);
|
||||
|
||||
// 处理常规实体列表
|
||||
this._entities.remove(entity);
|
||||
entity.onRemovedFromScene();
|
||||
entity.scene = null;
|
||||
|
||||
this.scene.entityProcessors.onEntityRemoved(entity);
|
||||
if (Core.entitySystemsEnabled)
|
||||
this.scene.entityProcessors.onEntityRemoved(entity);
|
||||
}
|
||||
|
||||
this._entitiesToRemove.length = 0;
|
||||
@@ -208,8 +211,9 @@ module es {
|
||||
entity.scene = this.scene;
|
||||
|
||||
this.addToTagList(entity);
|
||||
|
||||
this.scene.entityProcessors.onEntityAdded(entity);
|
||||
|
||||
if (Core.entitySystemsEnabled)
|
||||
this.scene.entityProcessors.onEntityAdded(entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user