Class: Game_SelfSwitches

Inherits:
Object
  • Object
show all
Defined in:
lib/rgss3_default_scripts/Game_SelfSwitches.rb

Overview

** Game_SelfSwitches


This class handles self switches. It's a wrapper for the built-in class

“Hash.” The instance of this class is referenced by $game_self_switches.

Instance Method Summary collapse

Constructor Details

#initializeGame_SelfSwitches


  • Object Initialization




12
13
14
# File 'lib/rgss3_default_scripts/Game_SelfSwitches.rb', line 12

def initialize
  @data = {}
end

Instance Method Details

#[](key) ⇒ Object


  • Get Self Switch




18
19
20
# File 'lib/rgss3_default_scripts/Game_SelfSwitches.rb', line 18

def [](key)
  @data[key] == true
end

#[]=(key, value) ⇒ Object


  • Set Self Switch

    value : ON (true) / OFF (false)
    



25
26
27
28
# File 'lib/rgss3_default_scripts/Game_SelfSwitches.rb', line 25

def []=(key, value)
  @data[key] = value
  on_change
end

#on_changeObject


  • Processing When Setting Self Switches




32
33
34
# File 'lib/rgss3_default_scripts/Game_SelfSwitches.rb', line 32

def on_change
  $game_map.need_refresh = true
end