------------------------------------------------------------------------------
-- class 'NoSkipNMinigames'
------------------------------------------------------------------------------

class 'NoSkipNMinigames' (RSLAchievment)

------------------------------------------------------------------------------
function NoSkipNMinigames:__init(game_scene)
	Achievment.__init(self, game_scene)
	self.name = 'NoSkipNMinigames'
	self:addEventHandler('on_skip_pressed', bind(self.onSkipPressed, self))
	self:addEventHandler('on_minigame_completed', bind(self.onMinigameCompleted, self))

	self.used_skip = false
	self.num_minigames_to_complete = 5 
	self.num_minigames_completed = 0
end

------------------------------------------------------------------------------
function NoSkipNMinigames:onSkipPressed(args)
	self.used_skip = true
end

------------------------------------------------------------------------------
function NoSkipNMinigames:onMinigameCompleted(args)
	if not self.used_skip then
		self.num_minigames_completed = self.num_minigames_completed + 1
	end
	if self.num_minigames_completed == self.num_minigames_to_complete then
		self:setCompleted(true)
	end
	self.used_skip = false
end