Class: MapTileGenerator

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(map:, height_perlin_generator: nil, moist_perlin_generator: nil, temp_perlin_generator: nil) ⇒ MapTileGenerator

Returns a new instance of MapTileGenerator.



9
10
11
12
13
14
15
# File 'lib/map_tile_generator.rb', line 9

def initialize(map:, height_perlin_generator: nil, moist_perlin_generator: nil, temp_perlin_generator: nil)
  @map = map
  @map_config = map.config
  @height_perlin_generator = height_perlin_generator || default_perlin_height_generator
  @moist_perlin_generator = moist_perlin_generator || default_perlin_moist_generator
  @temp_perlin_generator = temp_perlin_generator || default_perlin_temp_generator
end

Instance Attribute Details

#height_perlin_generatorObject (readonly)

Returns the value of attribute height_perlin_generator.



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

def height_perlin_generator
  @height_perlin_generator
end

#mapObject (readonly)

Returns the value of attribute map.



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

def map
  @map
end

#map_configObject (readonly)

Returns the value of attribute map_config.



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

def map_config
  @map_config
end

#moist_perlin_generatorObject (readonly)

Returns the value of attribute moist_perlin_generator.



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

def moist_perlin_generator
  @moist_perlin_generator
end

#temp_perlin_generatorObject (readonly)

Returns the value of attribute temp_perlin_generator.



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

def temp_perlin_generator
  @temp_perlin_generator
end

Instance Method Details

#generateObject



17
18
19
20
# File 'lib/map_tile_generator.rb', line 17

def generate
  puts "generating #{map_config.width} x #{map_config.height} tiles..." if map_config.verbose
  positive_quadrant_cartesian_plane
end