------------------------------------------------------------------------------
-- class 'CollectNClock'
------------------------------------------------------------------------------

class 'CollectNClock' (RSLAchievment)

------------------------------------------------------------------------------
function CollectNClock:__init(game_scene)
	Achievment.__init(self, game_scene)
	self.name = 'CollectNClock'
	self:addEventHandler('on_clock_collect', bind(self.onClockCollect, self))

	self.num_clocks_to_collect = 1 
	self.num_clocks_collected = HasGameState('CLOCK_COLLECTED') and tonumber(GetGameState('CLOCK_COLLECTED'):get(0)) or 0
end

------------------------------------------------------------------------------
function CollectNClock:onClockCollect(args)
	self.num_clocks_collected = HasGameState('CLOCK_COLLECTED') and tonumber(GetGameState('CLOCK_COLLECTED'):get(0)) or 0
	if self.num_clocks_collected == self.num_clocks_to_collect then
		self:setCompleted(true)
	end
end