iupdatable无法判断接口 去除改为component支持

This commit is contained in:
yhh
2020-07-13 12:48:42 +08:00
parent c30e591f6e
commit 983c8fbc99
14 changed files with 29 additions and 74 deletions

View File

@@ -6,8 +6,6 @@ class ComponentList {
private _componentsToAdd: Component[] = [];
/** 标记要删除此框架的组件列表。用来对组件进行分组,这样我们就可以同时进行加工 */
private _componentsToRemove: Component[] = [];
/** 需要调用更新的所有组件的列表 */
private _updatableComponents: IUpdatable[] = [];
private _tempBufferList: Component[] = [];
constructor(entity: Entity) {
@@ -48,7 +46,6 @@ class ComponentList {
}
this._components.length = 0;
this._updatableComponents.length = 0;
this._componentsToAdd.length = 0;
this._componentsToRemove.length = 0;
}
@@ -61,10 +58,6 @@ class ComponentList {
if (component instanceof RenderableComponent)
this._entity.scene.renderableComponents.remove(component);
// 处理IUpdatable
if (egret.is(component, "IUpdatable"))
this._updatableComponents.remove(component);
this._entity.componentBits.set(ComponentTypeManager.getIndexFor(component), false);
this._entity.scene.entityProcessors.onComponentRemoved(this._entity);
}
@@ -77,9 +70,6 @@ class ComponentList {
if (component instanceof RenderableComponent)
this._entity.scene.renderableComponents.add(component);
if (egret.is(component, "IUpdatable"))
this._updatableComponents.push(component as any);
this._entity.componentBits.set(ComponentTypeManager.getIndexFor(component));
this._entity.scene.entityProcessors.onComponentAdded(this._entity);
}
@@ -104,9 +94,6 @@ class ComponentList {
if (component instanceof RenderableComponent)
this._entity.scene.renderableComponents.add(component);
if (egret.is(component, "IUpdatable"))
this._updatableComponents.push(component as any);
this._entity.componentBits.set(ComponentTypeManager.getIndexFor(component));
this._entity.scene.entityProcessors.onComponentAdded(this._entity);
@@ -148,9 +135,6 @@ class ComponentList {
if (component instanceof RenderableComponent)
this._entity.scene.renderableComponents.remove(component);
if (egret.is(component, "IUpdatable"))
this._updatableComponents.remove(component);
this._entity.componentBits.set(ComponentTypeManager.getIndexFor(component), false);
this._entity.scene.entityProcessors.onComponentRemoved(this._entity);
@@ -224,8 +208,8 @@ class ComponentList {
public update() {
this.updateLists();
for (let i = 0; i < this._updatableComponents.length; i++) {
let updatable = this._updatableComponents[i];
for (let i = 0; i < this._components.length; i++) {
let updatable = this._components[i];
let updateableComponent;
if (updatable instanceof Component)
updateableComponent = updatable as Component;