Class: Game_Timer
- Inherits:
-
Object
- Object
- Game_Timer
- Defined in:
- lib/rgss3_default_scripts/Game_Timer.rb
Overview
** Game_Timer
This class handles timers. Instances of this class are referenced by
$game_timer.
Instance Method Summary collapse
-
#initialize ⇒ Game_Timer
constructor
————————————————————————– * Object Initialization ————————————————————————–.
-
#on_expire ⇒ Object
————————————————————————– * Processing When Timer Reaches 0 ————————————————————————–.
-
#sec ⇒ Object
————————————————————————– * Get Seconds ————————————————————————–.
-
#start(count) ⇒ Object
————————————————————————– * Start ————————————————————————–.
-
#stop ⇒ Object
————————————————————————– * Stop ————————————————————————–.
-
#update ⇒ Object
————————————————————————– * Frame Update ————————————————————————–.
-
#working? ⇒ Boolean
————————————————————————– * Determine if Working ————————————————————————–.
Constructor Details
#initialize ⇒ Game_Timer
-
Object Initialization
12 13 14 15 |
# File 'lib/rgss3_default_scripts/Game_Timer.rb', line 12 def initialize @count = 0 @working = false end |
Instance Method Details
#on_expire ⇒ Object
-
Processing When Timer Reaches 0
53 54 55 |
# File 'lib/rgss3_default_scripts/Game_Timer.rb', line 53 def on_expire BattleManager.abort end |
#sec ⇒ Object
-
Get Seconds
47 48 49 |
# File 'lib/rgss3_default_scripts/Game_Timer.rb', line 47 def sec @count / Graphics.frame_rate end |
#start(count) ⇒ Object
-
Start
28 29 30 31 |
# File 'lib/rgss3_default_scripts/Game_Timer.rb', line 28 def start(count) @count = count @working = true end |
#stop ⇒ Object
-
Stop
35 36 37 |
# File 'lib/rgss3_default_scripts/Game_Timer.rb', line 35 def stop @working = false end |
#update ⇒ Object
-
Frame Update
19 20 21 22 23 24 |
# File 'lib/rgss3_default_scripts/Game_Timer.rb', line 19 def update if @working && @count > 0 @count -= 1 on_expire if @count == 0 end end |
#working? ⇒ Boolean
-
Determine if Working
41 42 43 |
# File 'lib/rgss3_default_scripts/Game_Timer.rb', line 41 def working? @working end |