class 'l_08_Lauras_room_Z_Bed' (ZoomZone)

function l_08_Lauras_room_Z_Bed:__init(name, mode, PlayField)
	ZoomZone.__init(self, name, mode, PlayField)
	self:entityHide('zb_pillow_2','zb_coverlet_3','zb_wig_2','zt_vase_3','area_apply_08_wig','area_click_to_hide')


	do 
		local counter = 2

		local function on_apply_08_vase_and_pillow(event)	


			if event.toolName == '08_pillow' then 
				counter = counter - 1 
		  		self:entityShow('zb_pillow_2')
		  		self.playfield:getEntityNamed('pillow_2'):show() 			
		  			
		   		if not event.save then
		   		    self.playfield:entityFadeShow('pillow_2')
		   			self.playfield:entityFadeShow('zb_pillow_2')

		   			-- actionScreen
			    	self.playfield.action:incrementActionBar(10)
			    	----------------------------------------------------------
		  		end

			elseif event.toolName == '08_vase' then

				counter = counter - 1 	
		
		  	    self:entityShow('zt_vase_3','area_apply_08_wig')
		  	     self.playfield:getEntityNamed('Vase_3'):show() 	
		  		if not event.save then
		  			self:playSound('08_apply_vase')
		   			self:getEntityNamed('zt_vase_3'):ChangeOpacity(0, 1, 0.5)
		   			self.playfield:entityFadeShow('Vase_3')

		   			-- actionScreen
			    	self.playfield.action:incrementActionBar(10)
			    	----------------------------------------------------------
		  		end

		  	end

		  	if counter == 0 then 
		  		self:entityHide('area_apply_08_vase_and_pillow')
		  	else
				self:getEntityNamed('area_apply_08_vase_and_pillow'):setCursorOverName('CursorGlass')	
		  	end 
		   
		end
		self:registerToolApplyInfo( '08_vase', 'area_apply_08_vase_and_pillow', on_apply_08_vase_and_pillow, 'BBT_NEED_08_VASE_AND_PILLOW' )
		self:registerToolApplyInfo( '08_pillow', 'area_apply_08_vase_and_pillow', on_apply_08_vase_and_pillow, 'BBT_NEED_08_VASE_AND_PILLOW' )
	end


	local function on_apply_08_wig(event)		
	  		self:entityHide('area_apply_08_wig')
	  	    self:entityShow('zb_wig_2','area_click_to_hide')
	  	     self.playfield:getEntityNamed('wig_2'):show() 	
	  		if not event.save then
	  			self:playSound('08_apply_wig') 
	   			self:getEntityNamed('zb_wig_2'):ChangeOpacity(0, 1, 0.5)
	   			self.playfield:entityFadeShow('wig_2')

	   			-- actionScreen
		    	self.playfield.action:incrementActionBar(10)
		    	----------------------------------------------------------
	  		end
	end
	self:registerToolApplyInfo('08_wig', 'area_apply_08_wig', on_apply_08_wig, 'BBT_NEED_08_WIG')

	local function on_click_to_hide(event)
	    self:entityHide(event.target)
        
        self:entityShow('zb_coverlet_3')
        self.playfield:entityShow('area_bbt_like_Laura')
        self.playfield:entityHide('coverlet_2')
        self.playfield:getEntityNamed('coverlet_3'):show() 
		if IsToolFound('08_rope_ladder_2') then
			self.playfield:entityShow('area_click_shelf')
			self.playfield:entityHide('area_click_bbt')
		end
        SetGameState('Click_to_hide_bad', 'true')
	    if not event.save then 

	    	self:playSound('08_click_to_hide')
	       
		    self:getEntityNamed('zb_coverlet_3'):ChangeOpacity(0, 1, 0.5)
		    self.playfield:entityFadeShow('coverlet_3')

		    -- actionScreen
	    	self.playfield.action:incrementActionBar(10)
	    	----------------------------------------------------------

	    	self.mouseBlocker:push()
			self.timer:add( function()
								self.mouseBlocker:pop()
								self:closeAndDisable()
							end, 1) 
		else
			self:closeAndDisable()
		--	self.playfield:entityHide('area_click_bbt')
		end


	end
	self:registerActiveObject('area_click_to_hide', on_click_to_hide)





end

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

function l_08_Lauras_room_Z_Bed:CreateLoaderTable()
	local objects =
	{
		{ name = 'zb_bg',  entityType = 'SpriteEntity',  x = 512,  y = 384,  order = 0,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/Scenes/08_Lauras_room/Z_Bed/zb_bg.jpg',  width = 640,  height = 480,  },
		{ name = 'zb_headboard',  entityType = 'SpriteEntity',  x = 753,  y = 510,  order = 100,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/Scenes/08_Lauras_room/Z_Bed/zb_headboard.png',  width = 158,  height = 228,  },
		{ name = 'area_apply_08_vase_and_pillow',  entityType = 'SpriteEntity',  x = 569,  y = 440,  order = 20,  color = {r = 1, g = 1, b = 1, a = 0.00392157},  editingLocked = false,  treeItemIsExpanded = true,  width = 500,  height = 200,  },
		{ name = 'zb_coverlet_2',  entityType = 'SpriteEntity',  x = 683,  y = 505,  order = 10,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/Scenes/08_Lauras_room/Z_Bed/zb_coverlet_2.png',  width = 302,  height = 208,  },
		{ name = 'zb_pillow_3',  entityType = 'SpriteEntity',  x = 640,  y = 463,  order = 3,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/Scenes/08_Lauras_room/Z_Bed/zb_pillow_3.png',  width = 164,  height = 108,  },
		{ name = 'zb_wig_2',  entityType = 'SpriteEntity',  x = 505,  y = 439,  order = 8,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/Scenes/08_Lauras_room/Z_Bed/zb_wig_2.png',  width = 172,  height = 146,  },
		{ name = 'zt_vase_3',  entityType = 'SpriteEntity',  x = 499,  y = 437,  order = 7,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/Scenes/08_Lauras_room/Z_Bed/zt_vase_3.png',  width = 125,  height = 102,  },
		{ name = 'zb_pillow_2',  entityType = 'SpriteEntity',  x = 600,  y = 464,  order = 9,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/Scenes/08_Lauras_room/Z_Bed/zb_pillow_2.png',  width = 148,  height = 114,  },
		{ name = 'zb_pillow_4',  entityType = 'SpriteEntity',  x = 540,  y = 443,  order = 6,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/Scenes/08_Lauras_room/Z_Bed/zb_pillow_4.png',  width = 156,  height = 116,  },
		{ name = 'zb_pillow_1',  entityType = 'SpriteEntity',  x = 445,  y = 429,  order = 2,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/Scenes/08_Lauras_room/Z_Bed/zb_pillow_1.png',  width = 180,  height = 116,  },
		{ name = 'area_apply_08_wig',  entityType = 'SpriteEntity',  x = 472.5,  y = 445.5,  order = 22,  color = {r = 1, g = 1, b = 1, a = 0.00392157},  editingLocked = false,  treeItemIsExpanded = true,  hotSpot = {x = 82.5, y = 77.5},  width = 165,  height = 155,  },
		{ name = 'area_click_to_hide',  entityType = 'SpriteEntity',  x = 569,  y = 440,  order = 19,  color = {r = 1, g = 1, b = 1, a = 0.00392157},  editingLocked = false,  treeItemIsExpanded = true,  width = 500,  height = 200,  },
		{ name = 'zb_coverlet_3',  entityType = 'SpriteEntity',  x = 599,  y = 487,  order = 50,  isVisible = false,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/Scenes/08_Lauras_room/Z_Bed/zb_coverlet_3.png',  width = 464,  height = 246,  },
	}
	return objects
end
