class Hallway
Constants
- HALLWAYS_LENGTH
Should be half room size
- HALLWAYS_WIDTH
Attributes
disabled[R]
hallway_id[RW]
rooms[R]
Public Class Methods
new()
click to toggle source
# File lib/hallways/hallway.rb, line 12 def initialize @disabled = false @hallway_id = nil end
Public Instance Methods
disable!()
click to toggle source
# File lib/hallways/hallway.rb, line 17 def disable! @disabled = true end
get_direction_array( rooms_keys, room, input_output )
click to toggle source
# File lib/hallways/hallway.rb, line 29 def get_direction_array( rooms_keys, room, input_output ) return [ nil, nil ] if disabled return [ input_output[0], self ] if rooms_keys[0] == room.top_left_array return [ input_output[1], self ] if rooms_keys[1] == room.top_left_array [ nil, nil ] end
set_draw_base_room( draw_base_room )
click to toggle source
# File lib/hallways/hallway.rb, line 21 def set_draw_base_room( draw_base_room ) @draw_base_room = draw_base_room end
to_hash()
click to toggle source
# File lib/hallways/hallway.rb, line 25 def to_hash { hallway_id: @hallway_id, klass: self.class.name, disabled: @disabled, draw_base_room: @draw_base_room.id } end
Private Instance Methods
draw( gc, width, height, min_x, max_x, min_y, max_y, x_decal: 0, y_decal: 0 )
click to toggle source
# File lib/hallways/hallway.rb, line 38 def draw( gc, width, height, min_x, max_x, min_y, max_y, x_decal: 0, y_decal: 0 ) gc.rectangle( min_x, min_y, max_x, max_y ) # Squares 1.upto( width ).each do |t| gc.line( min_x + SQUARE_SIZE_IN_PIXELS*t - x_decal, min_y, min_x + SQUARE_SIZE_IN_PIXELS*t - x_decal, max_y ) end 1.upto( height ).each do |t| gc.line( min_x, min_y + SQUARE_SIZE_IN_PIXELS*t - y_decal, max_x, min_y + SQUARE_SIZE_IN_PIXELS*t - y_decal ) end end