diff options
| author | realtradam <[email protected]> | 2021-05-20 05:04:21 -0400 |
|---|---|---|
| committer | realtradam <[email protected]> | 2021-05-20 05:04:21 -0400 |
| commit | f97a9ca95e464e728bba9337b579bc380c33bc7d (patch) | |
| tree | dd45a6e615e6e873cee15cb41daaca24b3357ea6 /app/lib/component_manager.rb | |
| parent | fee80f42f0889f2d484e25f4366f14b68c65ba70 (diff) | |
| download | typemon-code-f97a9ca95e464e728bba9337b579bc380c33bc7d.tar.gz typemon-code-f97a9ca95e464e728bba9337b579bc380c33bc7d.zip | |
implemented hitboxes
Diffstat (limited to 'app/lib/component_manager.rb')
| -rw-r--r-- | app/lib/component_manager.rb | 20 |
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 |
