Class: MapEntity::EntityBuilder

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

Overview

Entity builder class

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEntityBuilder

Returns a new instance of EntityBuilder.



35
36
37
# File 'lib/map/entity.rb', line 35

def initialize()
  @entity = Entity.new()
end

Instance Attribute Details

#entityObject (readonly)

Returns the value of attribute entity.



39
40
41
# File 'lib/map/entity.rb', line 39

def entity
  @entity
end

Instance Method Details

#add_nametag(nametag) ⇒ Object



51
52
53
# File 'lib/map/entity.rb', line 51

def add_nametag(nametag)
  @entity.nametag = nametag
end

#add_type(type) ⇒ Object



47
48
49
# File 'lib/map/entity.rb', line 47

def add_type(type)
  @entity.type = type
end

#build_entity(type, nametag) ⇒ Object

Builds the entity of a dungeon



42
43
44
45
# File 'lib/map/entity.rb', line 42

def build_entity(type, nametag)
  add_type(type)
  add_nametag(nametag)
end