class Degica::Door
Attributes
description[R]
Public Class Methods
new(room1, room2)
click to toggle source
# File lib/degica/door.rb, line 8 def initialize(room1, room2) @description = DoorNameGenerator.sample @rooms = [room1, room2] # connect rooms room1.doors << self room2.doors << self end
Public Instance Methods
actions()
click to toggle source
# File lib/degica/door.rb, line 17 def actions [Action.new(:enter, self), Action.new(:open, self)] end
describe()
click to toggle source
# File lib/degica/door.rb, line 33 def describe @description end
enter()
click to toggle source
# File lib/degica/door.rb, line 26 def enter next_room = (@rooms - [Game.objects.actor.location])[0] Game.objects.actor.location = next_room next_room.generate! next_room end
open()
click to toggle source
# File lib/degica/door.rb, line 21 def open Game.objects.actor.focus = self "You opened the door. Try to (enter) it.".highlight end
prompt()
click to toggle source
# File lib/degica/door.rb, line 37 def prompt "door" end