Class: Worlds::Entity

Inherits:
Object
  • Object
show all
Defined in:
lib/worlds/entity.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEntity

Returns a new instance of Entity.



10
11
12
# File 'lib/worlds/entity.rb', line 10

def initialize
  @components = []
end

Class Attribute Details

.playerObject

Returns the value of attribute player.



7
8
9
# File 'lib/worlds/entity.rb', line 7

def player
  @player
end

Instance Attribute Details

#areaObject

Returns the value of attribute area.



4
5
6
# File 'lib/worlds/entity.rb', line 4

def area
  @area
end

#componentsObject (readonly)

Returns the value of attribute components.



3
4
5
# File 'lib/worlds/entity.rb', line 3

def components
  @components
end

Instance Method Details

#update(ms) ⇒ Object



14
15
16
17
18
# File 'lib/worlds/entity.rb', line 14

def update(ms)
  components.flat_map { |component|
    component.update(ms)
  }
end