lib/baku/entity_manager.rb in baku-0.2.5 vs lib/baku/entity_manager.rb in baku-0.2.6
- old
+ new
@@ -72,15 +72,15 @@
def on_entity_component_added(entity, component)
add_entity_to_matching_component_lists(entity)
end
def on_entity_component_removed(entity, component)
- old_mask = ComponentMask.from_components(entity.components + component)
+ old_mask = ComponentMask.from_components(entity.components.keys + [component.class])
new_mask = entity.component_mask
@entities_by_component_mask.each do |component_mask, entities|
- old_match = component_mask.match?(old_mask)
- new_match = component_mask.match?(new_mask)
+ old_match = component_mask.matches?(old_mask)
+ new_match = component_mask.matches?(new_mask)
if old_match && !new_match
entities.delete(entity)
end
end