Class: Gamefic::Narrator
- Inherits:
-
Object
- Object
- Gamefic::Narrator
- Defined in:
- lib/gamefic/narrator.rb
Overview
A narrative controller.
Instance Attribute Summary collapse
- #plot ⇒ Plot readonly
Instance Method Summary collapse
-
#cast(character = plot.introduce) ⇒ Actor, Active
Cast a player character in the plot.
- #concluding? ⇒ Boolean
-
#finish ⇒ void
Finish a turn.
-
#initialize(plot) ⇒ Narrator
constructor
A new instance of Narrator.
- #players ⇒ Object
-
#start ⇒ void
Start a turn.
-
#uncast(character) ⇒ Actor, Active
Uncast a player character from the plot.
Constructor Details
#initialize(plot) ⇒ Narrator
Returns a new instance of Narrator.
10 11 12 13 |
# File 'lib/gamefic/narrator.rb', line 10 def initialize(plot) @plot = plot last_cues end |
Instance Attribute Details
Instance Method Details
#cast(character = plot.introduce) ⇒ Actor, Active
Cast a player character in the plot.
19 20 21 |
# File 'lib/gamefic/narrator.rb', line 19 def cast(character = plot.introduce) plot.cast character end |
#concluding? ⇒ Boolean
54 55 56 |
# File 'lib/gamefic/narrator.rb', line 54 def concluding? plot.concluding? end |
#finish ⇒ void
This method returns an undefined value.
Finish a turn.
48 49 50 51 52 |
# File 'lib/gamefic/narrator.rb', line 48 def finish cues.each(&:finish) cues.clear plot.update_blocks.each(&:call) end |
#players ⇒ Object
31 32 33 |
# File 'lib/gamefic/narrator.rb', line 31 def players plot.players end |
#start ⇒ void
This method returns an undefined value.
Start a turn.
38 39 40 41 42 43 |
# File 'lib/gamefic/narrator.rb', line 38 def start next_cues plot.ready_blocks.each(&:call) plot.turn cues.each(&:prepare) end |