Class: Game_Timer

Inherits:
Object
  • Object
show all
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

Constructor Details

#initializeGame_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_expireObject


  • Processing When Timer Reaches 0




53
54
55
# File 'lib/rgss3_default_scripts/Game_Timer.rb', line 53

def on_expire
  BattleManager.abort
end

#secObject


  • 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

#stopObject


  • Stop




35
36
37
# File 'lib/rgss3_default_scripts/Game_Timer.rb', line 35

def stop
  @working = false
end

#updateObject


  • 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


Returns:

  • (Boolean)


41
42
43
# File 'lib/rgss3_default_scripts/Game_Timer.rb', line 41

def working?
  @working
end