Sha256: 87eb437334e443b52400976d11ce03e2f7891f6a21720137e531052c7d43f0aa
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
require 'gamefic/subplot' module Gamefic module Plot::Host # Get an array of all the current subplots. # # @return [Array<Subplot>] def subplots p_subplots.clone end # Start a new subplot based on the provided class. # # @param subplot_class [Class] The class of the subplot to be created (Subplot by default) # @return [Subplot] 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 # Get the player's current subplot or nil if none exists. # # @return [Subplot] def subplot_for player subplots.each { |s| return s if s.players.include?(player) } nil end # Determine whether the player is involved in a subplot. # # @return [Boolean] def in_subplot? player !subplot_for(player).nil? end private def p_subplots @p_subplots ||= [] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gamefic-1.6.0 | lib/gamefic/plot/host.rb |