class 'l_01_Boat_crash_site_Z_Yacht' (ZoomZone)

function l_01_Boat_crash_site_Z_Yacht:__init(name, mode, PlayField)
	ZoomZone.__init(self, name, mode, PlayField)
	
	----------------------------------------------------------------------------
	self:entityHide('zy_rope_2')
	----------------------------------------------------------------------------
	----------------------------------------------------------------------------
	local close_counter = 3
	local function decrement_close_counter()
	    close_counter = close_counter - 1
	    if close_counter <= 0 then
	        self:closeAndDisable()
	    end
	end
	----------------------------------------------------------------------------

	-- apply harpoon -----------------------------------------------------------
	do
		local function on_close()
			if not HasGameState('01_ZY_TEXT_SHOWN') then
				SetGameState('01_ZY_TEXT_SHOWN', 'true')

				local text = createVideo({video = '01_zy_text', sound = '01_zy_text', scale = 1, order = 450, x = -49, y = -7, 
										parent = self.main_entity, isLooped = false, isAlpha = false})
				text:setOpacity(0.9)
				text:play()
				

				self.playfield.mouseBlocker:push()
				text.onFinish:add( function()

										self.playfield:showBlackBar('BBT_01_HELP_ME')

										self.timer:add( function()
						  					self.playfield:hideBlackBar('BBT_01_HELP_ME')
						  				end, 4)

										self.playfield.mouseBlocker:pop()	
										text:ChangeOpacity(1, 0, 0.5)
										self:getEntityNamed('zy_mouse'):show()
									end)
			end
		end

		local function on_find_zy_harpoon(e)
				        
	        self:entityHide('zy_harpoon')
	        

	        self.playfield.harpoon_moln_1:setOpacity(0)
			self.playfield.harpoon_1:setOpacity(0)
			self.playfield.harpoon_moln_2:setOpacity(0)
			self.playfield.harpoon_2:setOpacity(0)
			self.playfield.harpoon_bg:setOpacity(0)
	        
	        decrement_close_counter()

	        if e.save then
	      		self:entityHide(e.target)
	        	self:getEntityNamed('zy_mouse'):show()
	        end
	    end
	    self:registerToolFindInfo('01_harpoon', 'area_find_zy_harpoon', on_find_zy_harpoon, nil, on_close)
	end
	----------------------------------------------------------------------------

	-- apply glove -------------------------------------------------------------
	do
		local function on_apply_zy_glove(e)
	        self:entityHide(e.target)
	        
	        self:entityHide('zy_conductor')
	        
	        decrement_close_counter()
	        self:findTool('01_bulb_lamp')
			if not e.save then
				self:playSound('01_apply_zy_glove')
			end       
	    end
	    self:registerToolApplyInfo('03_glove', 'area_apply_zy_glove', on_apply_zy_glove, 'BBT_01_NEED_GLOVE')
	end
	----------------------------------------------------------------------------

	-- apply glove -------------------------------------------------------------
	do
    	local function on_window_close()
			if not HasGameState('01_ZY_MOUSE_SHOWN') then
				SetGameState('01_ZY_MOUSE_SHOWN', 'true')

				local mouse = createVideo({video = '01_zy_mouse',  sound = '01_zy_mouse', scale = 2, order = 500, x = 0, y = 0, 
									parent = self.main_entity, isLooped = false, isAlpha = true})			
				mouse:play()

				self.playfield.mouseBlocker:push()
				mouse.onFinish:add( function()
										self.playfield.mouseBlocker:pop()										
										mouse:ChangeOpacity(1, 0, 0.5)
									end)
			end
    	end

		local function on_apply_zy_sabre(e)
		    self:entityHide(e.target)
		    
		    self.playfield.rope_moln_1:setOpacity(0)
			self.playfield.rope_1:setOpacity(0)
			self.playfield.rope_moln_2:setOpacity(0)
			self.playfield.rope_2:setOpacity(0)
			self.playfield.rope_bg:setOpacity(0)
	        self.playfield.nakladka_na_lodku_bg:setOpacity(0)
		    
		    if not e.save then
		        self:entityFadeHide('zy_rope_1')
		        self:entityFadeShow('zy_rope_2')

		    	self:playSound('01_apply_zy_sabre')

		        self.timer:add( function()
					                decrement_close_counter()
				                    self:findTool('01_strong_rope_net', nil, on_window_close)
					            end, 0.5 )
		    else
		        self:entityHide('zy_rope_1')
		        self:entityShow('zy_rope_2')	        	        
		    
		        decrement_close_counter()
	            self:findTool('01_strong_rope_net')
		    end	    
		end
		self:registerToolApplyInfo('02_sabre', 'area_apply_zy_sabre', on_apply_zy_sabre, 'BBT_01_NEED_SABRE')
	end
	----------------------------------------------------------------------------
end
----------------------------------------------------------------------------

--------------------------------------------------------------------------------
--                      GENERATED CONTENT. DO NOT EDIT.                       --
--------------------------------------------------------------------------------

function l_01_Boat_crash_site_Z_Yacht:CreateLoaderTable()
	local objects =
	{
		{ name = 'zy_bg',  entityType = 'SpriteEntity',  x = 512,  y = 384,  order = 0,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/Scenes/01_Boat_crash_site/Z_Yacht/zy_bg.jpg',  width = 640,  height = 480,  },
		{ name = '01_Boat_crash_site_Anim_Z_Yacht',  entityType = 'CompositionContainer',  x = 192,  y = 144,  order = 0,  isRespondable = false,  editingLocked = false,  treeItemIsExpanded = false,  path = 'Data/Scripts/Scenes/01_Boat_crash_site/Anim/01_Boat_crash_site_Anim_Z_Yacht.lua',  },
		{ name = 'compositionbg',  entityType = 'CompositionSequence',  parentName = '01_Boat_crash_site_Anim_Z_Yacht',  x = 0,  y = 0,  order = 0,  isRespondable = false,  editingLocked = false,  treeItemIsExpanded = false,  isCyclic = true,  speed = 1,  },
		{ name = 'zy_conductor',  entityType = 'SpriteEntity',  x = 391,  y = 248,  order = 10,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/Scenes/01_Boat_crash_site/Z_Yacht/zy_conductor.png',  width = 56,  height = 30,  },
		{ name = 'zy_rope_1',  entityType = 'SpriteEntity',  x = 686,  y = 305,  order = 20,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/Scenes/01_Boat_crash_site/Z_Yacht/zy_rope_1.png',  width = 294,  height = 324,  },
		{ name = 'zy_rope_2',  entityType = 'SpriteEntity',  x = 713,  y = 198,  order = 10,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/Scenes/01_Boat_crash_site/Z_Yacht/zy_rope_2.png',  width = 88,  height = 96,  },
		{ name = 'zy_harpoon',  entityType = 'SpriteEntity',  x = 499,  y = 381,  order = 30,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/Scenes/01_Boat_crash_site/Z_Yacht/zy_harpoon.png',  width = 390,  height = 164,  },
		{ name = 'compositionbg_over',  entityType = 'CompositionSequence',  x = 192,  y = 144,  order = 40,  isRespondable = false,  editingLocked = false,  treeItemIsExpanded = false,  isCyclic = true,  speed = 1,  },
		{ name = 'area_apply_zy_sabre',  entityType = 'SpriteEntity',  x = 681,  y = 300,  order = 100,  scaleX = 2.2,  scaleY = 3.1,  color = {r = 1, g = 1, b = 1, a = 0.00392157},  editingLocked = false,  treeItemIsExpanded = true,  width = 100,  height = 100,  },
		{ name = 'area_apply_zy_glove',  entityType = 'SpriteEntity',  x = 389,  y = 246,  order = 100,  color = {r = 1, g = 1, b = 1, a = 0.00392157},  editingLocked = false,  treeItemIsExpanded = true,  width = 100,  height = 100,  },
		{ name = 'area_find_zy_harpoon',  entityType = 'SpriteEntity',  x = 490,  y = 382,  order = 110,  angle = -20,  scaleX = 4,  scaleY = 1,  color = {r = 1, g = 1, b = 1, a = 0.00392157},  editingLocked = false,  treeItemIsExpanded = true,  width = 100,  height = 100,  },
		{ name = 'zy_mouse',  entityType = 'SpriteEntity',  x = 591,  y = 360,  order = 2,  isVisible = false,  isRespondable = false,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/Scenes/01_Boat_crash_site/Z_Yacht/zy_mouse.png',  width = 483,  height = 365,  },
	}
	return objects
end
