summaryrefslogtreecommitdiffhomepage
path: root/app/ECS/base_component.rb
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2021-05-14 05:48:50 -0400
committerrealtradam <[email protected]>2021-05-14 05:48:50 -0400
commit6a2996ceae968029be26ed7ebae8785dcfe877d2 (patch)
treef3d4d405f7e032fcabbb9711f75e266282d98295 /app/ECS/base_component.rb
parent57bd7ec9da14b3e7e338184568a273ce602e1557 (diff)
downloadtypemon-code-6a2996ceae968029be26ed7ebae8785dcfe877d2.tar.gz
typemon-code-6a2996ceae968029be26ed7ebae8785dcfe877d2.zip
added ECS system
Diffstat (limited to 'app/ECS/base_component.rb')
-rw-r--r--app/ECS/base_component.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/ECS/base_component.rb b/app/ECS/base_component.rb
new file mode 100644
index 0000000..a40ef52
--- /dev/null
+++ b/app/ECS/base_component.rb
@@ -0,0 +1,17 @@
+class ECS
+ class BaseComponent
+ class <<self
+ def data
+ @data ||= {}
+ end
+
+ def add(entity_id, **args)
+ data[entity_id] = new(**args)
+ end
+
+ def delete(entity_id)
+ data.delete entity_id
+ end
+ end
+ end
+end