class Gamefic::Active::Take

The combination of an actor and a scene to be performed in a plot turn.

Attributes

actor[R]

@return [Active]

cue[R]

@return [Active::Cue]

scene[R]

@return [Scene::Default]

Public Class Methods

finish(actor, cue, props) click to toggle source

@param actor [Active] @param cue [Active::Cue] @return [void]

# File lib/gamefic/active/take.rb, line 62
def self.finish actor, cue, props
  Take.new(actor, cue, props).finish
end
new(actor, cue, props = nil) click to toggle source

@param actor [Active] @param cue [Active::Cue] @param props [Props::Default, nil]

# File lib/gamefic/active/take.rb, line 20
def initialize actor, cue, props = nil
  @actor = actor
  @cue = cue
  @scene = actor.epic.select_scene(cue.scene)
  @props = props
end
start(actor, cue) click to toggle source

@param actor [Active] @param cue [Active::Cue] @return [Props::Default]

# File lib/gamefic/active/take.rb, line 55
def self.start actor, cue
  Take.new(actor, cue).start
end

Public Instance Methods

finish() click to toggle source

@return [void]

# File lib/gamefic/active/take.rb, line 46
def finish
  actor.flush
  scene.finish(actor, props)
  scene.run_finish_blocks actor, props
end
props() click to toggle source

@return [Props::Default]

# File lib/gamefic/active/take.rb, line 28
def props
  @props ||= @scene.new_props(**cue.context)
end
start() click to toggle source

@return [Props::Default]

# File lib/gamefic/active/take.rb, line 33
def start
  scene.run_start_blocks actor, props
  scene.start actor, props
  # @todo See if this can be handled better
  actor.epic.rulebooks.each { |rlbk| rlbk.run_player_output_blocks actor, props.output }
  props.output.merge!({
                        messages: actor.messages,
                        queue: actor.queue
                      })
  props
end