scope TimerUp initializer init
	import Game
	import Statistics
	import SoundControl

	constant string TIME_LIMIT_REACHED = "time-limit-reached.mp3"

	timer time = CreateTimer()

	function checkRoundSeconds takes nothing returns nothing
		if Game.roundEnabled and (Statistics.roundEndTime - Statistics.secondsElapsed) <= 0 then
			FogEnable(false)
			SoundControl.play(TIME_LIMIT_REACHED, 1., 127)
			Game.beastWin()
		end
	end

	function init takes nothing returns nothing
		TimerStart(CreateTimer(), 1., true, function checkRoundSeconds)
		SoundControl.preload(TIME_LIMIT_REACHED)
	end
endscope
