class Gubby::GameEntity
Attributes
components[R]
engine[RW]
entity_name[RW]
Public Class Methods
new(name = nil, *components)
click to toggle source
# File lib/gubby/game_entity.rb, line 10 def initialize(name = nil, *components) @components = [] @entity_name = name unless name.nil? add_component(*components) end
Public Instance Methods
add_component(*components)
click to toggle source
# File lib/gubby/game_entity.rb, line 18 def add_component(*components) components.each do |c| extend(c) @components.push(c) end @engine.refresh_entity(self) unless @engine.nil? end
destroy()
click to toggle source
# File lib/gubby/game_entity.rb, line 40 def destroy() @engine.remove_entity(self) end
remove_component(*components)
click to toggle source
# File lib/gubby/game_entity.rb, line 29 def remove_component(*components) components.each do |c| unextend(c) @components.delete(c) end @engine.refresh_entity(self) unless @engine.nil? end