blob: e64bc2178ac4df57a24fe60371bb3f747d237771 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
require_relative './base_component'
Dir[File.join(__dir__, 'components', '*.rb')].sort.each { |file| require file }
class ECS
class Components
class <<self
def entity_destroyed(entity_id)
constants.each do |component|
component.delete(entity_id) unless (component.id & ECS::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 & ECS::Entity.signatures[entity_id]).zero?
end
end
end
end
end
|