Class: Game_Switches
- Inherits:
-
Object
- Object
- Game_Switches
- Defined in:
- lib/rgss3_default_scripts/Game_Switches.rb
Overview
** Game_Switches
This class handles switches. It's a wrapper for the built-in class "Array."
The instance of this class is referenced by $game_switches.
Instance Method Summary collapse
-
#[](switch_id) ⇒ Object
————————————————————————– * Get Switch ————————————————————————–.
-
#[]=(switch_id, value) ⇒ Object
————————————————————————– * Set Switch value : ON (true) / OFF (false) ————————————————————————–.
-
#initialize ⇒ Game_Switches
constructor
————————————————————————– * Object Initialization ————————————————————————–.
-
#on_change ⇒ Object
————————————————————————– * Processing When Setting Switches ————————————————————————–.
Constructor Details
#initialize ⇒ Game_Switches
-
Object Initialization
12 13 14 |
# File 'lib/rgss3_default_scripts/Game_Switches.rb', line 12 def initialize @data = [] end |
Instance Method Details
#[](switch_id) ⇒ Object
-
Get Switch
18 19 20 |
# File 'lib/rgss3_default_scripts/Game_Switches.rb', line 18 def [](switch_id) @data[switch_id] || false end |
#[]=(switch_id, value) ⇒ Object
-
Set Switch
value : ON (true) / OFF (false)
25 26 27 28 |
# File 'lib/rgss3_default_scripts/Game_Switches.rb', line 25 def []=(switch_id, value) @data[switch_id] = value on_change end |
#on_change ⇒ Object
-
Processing When Setting Switches
32 33 34 |
# File 'lib/rgss3_default_scripts/Game_Switches.rb', line 32 def on_change $game_map.need_refresh = true end |