Class: Gamefic::Scene::MultipleChoice

Inherits:
Default
  • Object
show all
Defined in:
lib/gamefic/scene/multiple_choice.rb

Overview

A scene that presents a list of choices and processes the player’s input. If the input is not a valid choice, the scene gets recued.

Direct Known Subclasses

YesOrNo

Instance Attribute Summary

Attributes inherited from Default

#name

Instance Method Summary collapse

Methods inherited from Default

#conclusion?, #initialize, #new_props, #on_finish, #on_start, props_class, #run_finish_blocks, #run_start_blocks, #to_hash, #type

Constructor Details

This class inherits a constructor from Gamefic::Scene::Default

Instance Method Details

#finish(actor, props) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/gamefic/scene/multiple_choice.rb', line 16

def finish actor, props
  super
  return if props.index

  actor.tell format(props.invalid_message, input: props.input)
  actor.recue
end

#start(actor, props) ⇒ Object



11
12
13
14
# File 'lib/gamefic/scene/multiple_choice.rb', line 11

def start actor, props
  super
  actor.output[:options] = props.options
end