diff --git a/app/ecs/component.js b/app/ecs/component.js index 769c422..d2dc2d0 100644 --- a/app/ecs/component.js +++ b/app/ecs/component.js @@ -12,12 +12,10 @@ export default class Component { constructor(ecs) { this.ecs = ecs; + this.Instance = this.instanceFromSchema(); } allocateMany(count) { - if (!this.Instance) { - this.Instance = this.instanceFromSchema(); - } const results = []; while (count > 0) { results.push( diff --git a/app/ecs/ecs.js b/app/ecs/ecs.js index d683b46..5eee045 100644 --- a/app/ecs/ecs.js +++ b/app/ecs/ecs.js @@ -329,21 +329,6 @@ export default class Ecs { this.diff = {}; } - size() { - let size = 0; - // # of components. - size += 2; - for (const type in this.Components) { - size += Schema.sizeOf(type, {type: 'string'}); - } - // # of entities. - size += 4; - for (const entityId of this.entities) { - size += this.get(entityId).size(); - } - return size; - } - system(systemName) { return this.Systems[systemName]; }