Class: Gamefic::Scene::MultipleScene

Inherits:
MultipleChoice show all
Defined in:
lib/gamefic/scene/multiple_scene.rb

Instance Attribute Summary

Attributes inherited from MultipleChoice

#index, #invalid_message, #number, #selection

Attributes inherited from Base

#actor, #data, #input, #prompt, #type

Instance Method Summary collapse

Methods inherited from MultipleChoice

#options, #post_initialize

Methods inherited from Base

#[], #finished?, #initialize, #on_finish, on_start, #post_initialize, #start, start_block, subclass, #tracked=, #tracked?, tracked?, #update

Constructor Details

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

Instance Method Details

#finishObject



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

def finish
  get_choice
  unless selection.nil?
    actor.prepare option_map[selection]
  end
end

#map(option, scene) ⇒ Object

Parameters:



9
10
11
12
# File 'lib/gamefic/scene/multiple_scene.rb', line 9

def map option, scene
  options.push option
  option_map[option] = scene
end

#option_mapObject



3
4
5
# File 'lib/gamefic/scene/multiple_scene.rb', line 3

def option_map
  @option_map ||= {}
end

#stateObject



21
22
23
24
25
26
27
# File 'lib/gamefic/scene/multiple_scene.rb', line 21

def state
  entered = {}
  option_map.each_pair do |k, v|
    entered[k] = actor.entered?(v)
  end
  super.merge entered: entered
end