diff options
| author | realtradam <[email protected]> | 2021-06-10 12:04:40 -0400 |
|---|---|---|
| committer | realtradam <[email protected]> | 2021-06-10 12:04:40 -0400 |
| commit | 61b6b4f8e524eb93e56e5dbe62f2387ed39970e9 (patch) | |
| tree | 4963b5fd028634322b92f21dd399ca3da4a52959 /component_manager.rb | |
| parent | 4301561e90eaa1ac61885e10d6f77f42a879f7e1 (diff) | |
| download | FelECS-61b6b4f8e524eb93e56e5dbe62f2387ed39970e9.tar.gz FelECS-61b6b4f8e524eb93e56e5dbe62f2387ed39970e9.zip | |
proper implementation of entities and components + their documentation
Diffstat (limited to 'component_manager.rb')
| -rw-r--r-- | component_manager.rb | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/component_manager.rb b/component_manager.rb index 2f1b2e2..33cb931 100644 --- a/component_manager.rb +++ b/component_manager.rb @@ -7,18 +7,20 @@ class FelFlame @component_map = [] class <<self def entity_destroyed(entity_id) + #TODO: make it 'search by entity' to remove @component_map.delete(entity_id) - constants.each do |component| #TODO change delete to remove + constants.each do |component| #TODO: change delete to remove component.delete(entity_id) unless (component.signature & FelFlame::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).signature & FelFlame::Entity.signatures[entity_id]).zero? - end - @component_map[entity_id] = [] - end + #def entity_created(entity_id) + # #TODO: probably delete this, I dont think its needed in the new system + # constants.each do |component| + # const_get(component.to_s).add(entity_id) unless (const_get(component.to_s).signature & FelFlame::Entity.signatures[entity_id]).zero? + # end + # @component_map[entity_id] = [] + #end def new(component_name, *attrs, **attrs_with_defaults) const_set(component_name, Class.new(FelFlame::Helper::BaseComponent) {}) |
