summaryrefslogtreecommitdiffhomepage
path: root/app/lib/component_manager.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/lib/component_manager.rb')
-rw-r--r--app/lib/component_manager.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/app/lib/component_manager.rb b/app/lib/component_manager.rb
new file mode 100644
index 0000000..f5261a2
--- /dev/null
+++ b/app/lib/component_manager.rb
@@ -0,0 +1,20 @@
+#require 'app/ECS/base_component.rb'
+
+#require 'app/ECS/components/00_test_component.rb'
+#require 'app/ECS/components/01_based.rb'
+
+class Components
+ class <<self
+ def entity_destroyed(entity_id)
+ constants.each do |component|
+ component.delete(entity_id) unless (component.id & Entity.signatures[entity_id]).zero?
+ end
+ end
+
+ def entity_created(entity_id)
+ constants.each do |component|
+ const_get(component.to_s).add(entity_id) unless (const_get(component.to_s).id & Entity.signatures[entity_id]).zero?
+ end
+ end
+ end
+end