class Baku::ComponentSystem

Attributes

components[R]

Public Class Methods

new(components, game_loop_step) click to toggle source
# File lib/baku/component_system.rb, line 7
def initialize(components, game_loop_step)
  @components = components
  @game_loop_step = game_loop_step
end

Public Instance Methods

component_mask() click to toggle source
# File lib/baku/component_system.rb, line 25
def component_mask
  @component_mask ||= ComponentMask.from_components(@components)
end
process_entities(entities) click to toggle source
# File lib/baku/component_system.rb, line 18
def process_entities(entities)
  entities.each do |entity|
    entity_components = @components.map { |c| entity.get_component(c) }
    process_entity(entity, *entity_components)
  end
end
register_world(world) click to toggle source
Calls superclass method
# File lib/baku/component_system.rb, line 12
def register_world(world)
  super(world)

  world.entity_manager.register_component_mask(component_mask)
end

Protected Instance Methods

retrieve_entities() click to toggle source
# File lib/baku/component_system.rb, line 31
def retrieve_entities
  @world.entity_manager.get_entities(component_mask)
end