Class: Gamefic::Scene::MultipleChoice
- Defined in:
- lib/gamefic/scene/multiple_choice.rb
Overview
A scene that presents a list of choices. If the input does not match any of the choices, the scene gets recued.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Base
#actor, #context, #name, #narrative, #props
Class Method Summary collapse
Instance Method Summary collapse
- #finish ⇒ Object
-
#initialize ⇒ MultipleChoice
constructor
A new instance of MultipleChoice.
- #start ⇒ Object
Methods inherited from Base
finish_blocks, inherited, on_finish, on_start, props_class, #rename, rename, start_blocks, #to_hash, #type
Constructor Details
#initialize ⇒ MultipleChoice
Returns a new instance of MultipleChoice.
11 12 13 14 |
# File 'lib/gamefic/scene/multiple_choice.rb', line 11 def initialize(...) super props..concat(context[:options] || []) end |
Class Method Details
.type ⇒ Object
29 30 31 |
# File 'lib/gamefic/scene/multiple_choice.rb', line 29 def self.type 'MultipleChoice' end |
Instance Method Details
#finish ⇒ Object
22 23 24 25 26 27 |
# File 'lib/gamefic/scene/multiple_choice.rb', line 22 def finish return super if props.selected? actor.tell format(props., input: props.input) actor.recue end |
#start ⇒ Object
16 17 18 19 20 |
# File 'lib/gamefic/scene/multiple_choice.rb', line 16 def start super props.output[:options] = props. props end |