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
The Constant name assigned to this Scene
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
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
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
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
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
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
The list of Systems
this Scene contains @return [Array<System>]
# File lib/felflame/scene_manager.rb, line 21 def systems @systems ||= [] end