class FelFlame::Scn

Creates and manages Scenes. Scenes are collections of Systems, and execute all the Systems when called upon.

TODO: Improve Scenes overview

Attributes

const_name[R]

The Constant name assigned to this Scene

systems[W]

Allows overwriting the storage of systems, such as for clearing. This method should generally only need to be used internally and not by a game developer/ @!visibility private

Public Class Methods

new(name) click to toggle source

Create a new Scene using the name given @param name [String] String format must follow requirements of a constant

# File lib/felflame/scene_manager.rb, line 14
def initialize(name)
  FelFlame::Scenes.const_set(name, self)
  @const_name = name
end

Public Instance Methods

add(*systems_to_add) click to toggle source

Adds any number of Systems to this Scene @return [Boolean] true

# File lib/felflame/scene_manager.rb, line 34
def add(*systems_to_add)
  self.systems |= systems_to_add
  systems.sort_by!(&:priority)
  FelFlame::Stage.update_systems_list if FelFlame::Stage.scenes.include? self
  true
end
call() click to toggle source

Execute all systems in this Scene, in the order of their priority @return [Boolean] true

# File lib/felflame/scene_manager.rb, line 27
def call
  systems.each(&:call)
  true
end
clear() click to toggle source

Removes all Systems from this Scene @return [Boolean] true

# File lib/felflame/scene_manager.rb, line 52
def clear
  systems.clear
  FelFlame::Stage.update_systems_list if FelFlame::Stage.scenes.include? self
  true
end
remove(*systems_to_remove) click to toggle source

Removes any number of SystemS from this Scene @return [Boolean] true

# File lib/felflame/scene_manager.rb, line 43
def remove(*systems_to_remove)
  self.systems -= systems_to_remove
  systems.sort_by!(&:priority)
  FelFlame::Stage.update_systems_list if FelFlame::Stage.scenes.include? self
  true
end
systems() click to toggle source

The list of Systems this Scene contains @return [Array<System>]

# File lib/felflame/scene_manager.rb, line 21
def systems
  @systems ||= []
end