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