Class: Gamefic::Narrator

Inherits:
Object
  • Object
show all
Defined in:
lib/gamefic/narrator.rb

Overview

A narrative controller.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#plotPlot (readonly)

Returns:



8
9
10
# File 'lib/gamefic/narrator.rb', line 8

def plot
  @plot
end

Instance Method Details

#cast(character = plot.introduce) ⇒ Actor, Active

Cast a player character in the plot.

Parameters:

  • character (Actor, Active) (defaults to: plot.introduce)

Returns:



19
20
21
# File 'lib/gamefic/narrator.rb', line 19

def cast(character = plot.introduce)
  plot.cast character
end

#concluding?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/gamefic/narrator.rb', line 54

def concluding?
  plot.concluding?
end

#finishvoid

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

#playersObject



31
32
33
# File 'lib/gamefic/narrator.rb', line 31

def players
  plot.players
end

#startvoid

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

#uncast(character) ⇒ Actor, Active

Uncast a player character from the plot.

Parameters:

Returns:



27
28
29
# File 'lib/gamefic/narrator.rb', line 27

def uncast(character)
  plot.uncast character
end