Module: Gamefic::Plot::Host
- Included in:
- Gamefic::Plot
- Defined in:
- lib/gamefic/plot/host.rb
Instance Method Summary collapse
-
#branch(subplot_class = Gamefic::Subplot, introduce: nil, next_cue: nil, busy_cue: nil) ⇒ Subplot
Start a new subplot based on the provided class.
-
#in_subplot?(player) ⇒ Boolean
Determine whether the player is involved in a subplot.
-
#subplot_for(player) ⇒ Subplot
Get the player’s current subplot or nil if none exists.
-
#subplots ⇒ Array<Subplot>
Get an array of all the current subplots.
Instance Method Details
#branch(subplot_class = Gamefic::Subplot, introduce: nil, next_cue: nil, busy_cue: nil) ⇒ Subplot
Start a new subplot based on the provided class.
17 18 19 20 21 |
# File 'lib/gamefic/plot/host.rb', line 17 def branch subplot_class = Gamefic::Subplot, introduce: nil, next_cue: nil, busy_cue: nil subplot = subplot_class.new(self, introduce: introduce, next_cue: next_cue, busy_cue: busy_cue) p_subplots.push subplot subplot end |
#in_subplot?(player) ⇒ Boolean
Determine whether the player is involved in a subplot.
36 37 38 |
# File 'lib/gamefic/plot/host.rb', line 36 def in_subplot? player !subplot_for(player).nil? end |
#subplot_for(player) ⇒ Subplot
Get the player’s current subplot or nil if none exists.
26 27 28 29 30 31 |
# File 'lib/gamefic/plot/host.rb', line 26 def subplot_for player subplots.each { |s| return s if s.players.include?(player) } nil end |