Class: FelFlame::Scenes
- Inherits:
-
Object
- Object
- FelFlame::Scenes
- Defined in:
- felflame.rb,
scene_manager.rb
Overview
Creates and manages Scenes. Scenes are collections of Systems, and execute all the Systems when called upon.
TODO: Improve Scenes overview
Instance Attribute Summary collapse
-
#const_name ⇒ Object
readonly
The Constant name assigned to this Scene.
-
#systems ⇒ Array<System>
The list of Systems this Scene contains.
Instance Method Summary collapse
-
#add(*systems_to_add) ⇒ Boolean
Adds any number of Systems to this Scene.
-
#call ⇒ Boolean
Execute all systems in this Scene, in the order of their priority.
-
#clear ⇒ Boolean
Removes all Systems from this Scene.
-
#initialize(name) ⇒ Scenes
constructor
Create a new Scene using the name given.
-
#remove(*systems_to_remove) ⇒ Boolean
Removes any number of SystemS from this Scene.
Constructor Details
Instance Attribute Details
#const_name ⇒ Object (readonly)
The Constant name assigned to this Scene
4 5 6 |
# File 'scene_manager.rb', line 4 def const_name @const_name end |
#systems ⇒ Array<System>
The list of Systems this Scene contains
17 18 19 |
# File 'scene_manager.rb', line 17 def systems @systems ||= [] end |
Instance Method Details
#add(*systems_to_add) ⇒ Boolean
Adds any number of Systems to this Scene
30 31 32 33 34 35 |
# File 'scene_manager.rb', line 30 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 ⇒ Boolean
Execute all systems in this Scene, in the order of their priority
23 24 25 26 |
# File 'scene_manager.rb', line 23 def call systems.each(&:call) true end |
#clear ⇒ Boolean
Removes all Systems from this Scene
48 49 50 51 52 |
# File 'scene_manager.rb', line 48 def clear systems.clear FelFlame::Stage.update_systems_list if FelFlame::Stage.scenes.include? self true end |
#remove(*systems_to_remove) ⇒ Boolean
Removes any number of SystemS from this Scene
39 40 41 42 43 44 |
# File 'scene_manager.rb', line 39 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 |