80 lines
2.5 KiB
Ruby
80 lines
2.5 KiB
Ruby
#==============================================================================
|
|
# ** Game_Timer
|
|
#------------------------------------------------------------------------------
|
|
# This class handles timers. Instances of this class are referenced by
|
|
# $game_timer.
|
|
#==============================================================================
|
|
|
|
class Game_Timer
|
|
attr_accessor :count
|
|
#--------------------------------------------------------------------------
|
|
# * Object Initialization
|
|
#--------------------------------------------------------------------------
|
|
def initialize
|
|
@count = 0
|
|
@working = false
|
|
@chkMode = nil
|
|
@chkMax = nil
|
|
end
|
|
#--------------------------------------------------------------------------
|
|
# * Frame Update
|
|
#--------------------------------------------------------------------------
|
|
def update
|
|
if @working
|
|
return if @chkMode
|
|
if @count > 0
|
|
@count -= 1
|
|
off if @count <= 0
|
|
end
|
|
end
|
|
end
|
|
#--------------------------------------------------------------------------
|
|
# * Start
|
|
#--------------------------------------------------------------------------
|
|
def start(count)
|
|
@count = count
|
|
@working = true
|
|
end
|
|
def startChkMode(count)
|
|
@count = count
|
|
@chkMode = true
|
|
@working = true
|
|
end
|
|
#--------------------------------------------------------------------------
|
|
# * Stop
|
|
#--------------------------------------------------------------------------
|
|
def stop
|
|
@working = false
|
|
end
|
|
|
|
def off
|
|
@chkMode = nil
|
|
@chkMax = nil
|
|
@count = -1
|
|
@working = false
|
|
SceneManager.scene.spriteset.timer_sprite_force_update #force update to make spirte visible to false
|
|
end
|
|
#--------------------------------------------------------------------------
|
|
# * Determine if Working
|
|
#--------------------------------------------------------------------------
|
|
def working?
|
|
@working
|
|
end
|
|
#--------------------------------------------------------------------------
|
|
# * Get Seconds
|
|
#--------------------------------------------------------------------------
|
|
def sec
|
|
@count / Graphics.frame_rate
|
|
end
|
|
#--------------------------------------------------------------------------
|
|
# * Processing When Timer Reaches 0
|
|
#--------------------------------------------------------------------------
|
|
#def on_expire
|
|
# BattleManager.abort
|
|
#end
|
|
#--------------------------------------------------------------------------
|
|
# * 417 custom
|
|
#--------------------------------------------------------------------------
|
|
|
|
end
|