diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/felflame/component_manager.rb | 5 | ||||
| -rw-r--r-- | lib/felflame/entity_manager.rb | 21 | ||||
| -rw-r--r-- | lib/felflame/version.rb | 2 |
3 files changed, 14 insertions, 14 deletions
diff --git a/lib/felflame/component_manager.rb b/lib/felflame/component_manager.rb index e6c6d91..43932d2 100644 --- a/lib/felflame/component_manager.rb +++ b/lib/felflame/component_manager.rb @@ -220,8 +220,9 @@ class FelFlame # the remove command is called, breaking the loop if it # wasn't referencing a clone(will get Nil errors) iter = entities.map(&:clone) - iter.each do |entity_id| - FelFlame::Entities[entity_id].remove self #unless FelFlame::Entities[entity_id].nil? + iter.each do |entity| + #FelFlame::Entities[entity_id].remove self #unless FelFlame::Entities[entity_id].nil? + entity.remove self end self.class.data[id] = nil instance_variables.each do |var| diff --git a/lib/felflame/entity_manager.rb b/lib/felflame/entity_manager.rb index 74fc4c3..a05ef93 100644 --- a/lib/felflame/entity_manager.rb +++ b/lib/felflame/entity_manager.rb @@ -41,9 +41,8 @@ class FelFlame # @return [Boolean] +true+ def delete components.each do |component_manager, component_array| - component_array.each do |component_id| - component_manager[component_id].entities.delete(id) - #self.remove FelFlame::Components.const_get(component_manager.name)[component_id] + component_array.each do |component| + component.entities.delete(self) end end FelFlame::Entities.data[id] = nil @@ -58,12 +57,12 @@ class FelFlame def add(*components_to_add) components_to_add.each do |component| if components[component.class].nil? - components[component.class] = [component.id] - component.entities.push id + components[component.class] = [component] + component.entities.push self check_systems component, :addition_triggers - elsif !components[component.class].include? component.id - components[component.class].push component.id - component.entities.push id + elsif !components[component.class].include? component + components[component.class].push component + component.entities.push self check_systems component, :addition_triggers end end @@ -87,9 +86,9 @@ class FelFlame # @return [Boolean] +true+ def remove(*components_to_remove) components_to_remove.each do |component| - check_systems component, :removal_triggers if component.entities.include? id - component.entities.delete id - components[component.class].delete component.id + check_systems component, :removal_triggers if component.entities.include? self + component.entities.delete self + components[component.class].delete component end true end diff --git a/lib/felflame/version.rb b/lib/felflame/version.rb index f69ea19..8483c07 100644 --- a/lib/felflame/version.rb +++ b/lib/felflame/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Felflame - VERSION = "1.0.2" + VERSION = "2.0.0" end |
