Method: Chione::Archetype#construct_for

Defined in:
lib/chione/archetype.rb

#construct_for(world) ⇒ Object

Construct a new entity for the specified world with all of the archetype’s components.



78
79
80
81
82
83
84
85
86
# File 'lib/chione/archetype.rb', line 78

def construct_for( world )
  entity = world.create_blank_entity
  self.components.each do |component_type, args|
    component = component_type.new( *args )
    world.add_component_to( entity, component )
  end

  return entity
end