From 01c6a777cb084c6bbf4225e62ee4f8ecb98ca067 Mon Sep 17 00:00:00 2001 From: Matt Low Date: Mon, 27 Jan 2020 18:35:55 +0400 Subject: [PATCH] Process entities only if they are active and not removed --- core/src/com/me/common/ecs/EntitySystem.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/com/me/common/ecs/EntitySystem.java b/core/src/com/me/common/ecs/EntitySystem.java index 38ec1e6..a5b4170 100644 --- a/core/src/com/me/common/ecs/EntitySystem.java +++ b/core/src/com/me/common/ecs/EntitySystem.java @@ -27,8 +27,11 @@ public abstract class EntitySystem extends BaseSystem { } public void process(float dt) { - for (int i = 0, n = getEntities().size; i < n; i++) { - processEntity(entities.get(i), dt); + for (int i = 0, n = entities.size; i < n; i++) { + Entity entity = entities.items[i]; + if (!entity.removed && entity.active) { + processEntity(entity, dt); + } } }