Method: FelFlame::Entities#remove

Defined in:
lib/felflame/entity_manager.rb

#remove(*components_to_remove) ⇒ Boolean

Remove a component from the Entity

Parameters:

  • A component created from any component manager

Returns:

  • true



87
88
89
90
91
92
93
94
95
# File 'lib/felflame/entity_manager.rb', line 87

def remove(*components_to_remove)
  components_to_remove.each do |component|
    check_systems component, :removal_triggers if component.entities.include? self
    component.entities.delete self
    components[component.class].delete component
    components.delete component.class if components[component.class].empty?
  end
  true
end