Class: Gamefic::Scene::Question

Inherits:
Custom show all
Defined in:
lib/gamefic/scene/question.rb

Overview

Question Scenes handle a string of arbitrary input. Examples include asking for a password, a destination, or a topic of conversation. The finish block is solely responsible for processing the answer. After the scene is finished, the :active scene will automatically be cued if no other scene has been cued or prepared.

Instance Method Summary collapse

Methods inherited from Custom

#start

Methods inherited from Base

#prompt, #start, #state

Constructor Details

#initialize(prompt, &block) ⇒ Question

Returns a new instance of Question.



10
11
12
13
# File 'lib/gamefic/scene/question.rb', line 10

def initialize prompt, &block
  @prompt = prompt
  @finish = block
end

Instance Method Details

#finish(actor, input) ⇒ Object



14
15
16
17
18
# File 'lib/gamefic/scene/question.rb', line 14

def finish actor, input
  this_scene = actor.scene
  super
  actor.cue :active if (actor.scene == this_scene and actor.next_scene.nil?)
end