class 'l_05_Forest_path' (PlayField)

function l_05_Forest_path:__init(game_scene, name, path)
	PlayField.__init(self, game_scene, name, path)  

    self:linkScene('area_link_06',   'CursorUp',    '06_Town')
    self:linkScene('area_link_04',   'CursorDown',    '04_Gazebo')
    
    self:entityHide('area_link_06', 'area_apply_paper')
    self:playSound('fury_idle', true)
    -- FURY -------------------------------------------------------
    do
        if self:isFirstVisited() then
            self:entityHide('idle_fury')
            local fury_speak_01  = createVideo({video = 'fury_speak_1', sound = 'fury_speak_1', scale = 1.5, order = 12, x = 587, y = 248, isLooped = false, isAlpha = true})
            self:startCutScene(fury_speak_01 , nil, nil)

            local subtitles_1 = nil
            subtitles_1 = Subtitles(current_scene:getPanel())
            subtitles_1:pushReplic('SUB_05_FURY_SPEAK_1_1', 0, 7, true)
            subtitles_1:pushReplic('SUB_05_FURY_SPEAK_1_2', 7, 13, true)
          
            subtitles_1:play()
            fury_speak_01.onFinish:add( function()
                                            subtitles_1:destroy()  
                                            self:entityShow('idle_fury')
                                            self:getEntityNamed('idle_fury'):play()                                         
                                        end)
        end

        if not IsToolApplied('04_fury_hour_glass') then
            self.fury_shout  = createVideo({video = 'fury_shout', scale = 1.5, order = 12, x = 587, y = 233, isLooped = false, isAlpha = true, sound = 'fury_shout'})
            self.fury_shout:hide()
        end

        local function on_apply_04_fury_hour_glass(e)
            self:entityHide(e.target)
            self:entityShow('area_link_06')            
            self:stopSound('fury_idle')
            self:entityHide('idle_fury')
            if not e.save then
                completeGameTask('10')
                local disappear  = createVideo({video = 'disappear', sound = 'disappear', scale = 1.5, order = 12, x = 588, y = 233, isLooped = false, isAlpha = true})
                self:startCutScene(disappear , nil, nil)

                self.timer:add( function()
                                            self:entityFadeHide('layer_furia_shadow')
                                        end, 5)
            else
                self:getEntityNamed('layer_furia_shadow'):hide()
                self.timer:add( function()
                                completeGameTask('10')
                            end, 0)
            end
        end
        local info = self:registerToolApplyInfo('04_fury_hour_glass', 'area_apply_04_fury_hour_glass', on_apply_04_fury_hour_glass, 'BBT_05_NEED_FURY_HOUR_GLASS')
        
        info.on_target_click = function ()
            addGameTask('10')
            --self:stopSound('fury_idle')

            self:entityFadeHide('idle_fury')
            self.fury_shout:setOpacity(1)
            self.fury_shout:show()
            self.fury_shout:stop()            
            self.fury_shout:play()            

            self.timer:add( function()
                                self:getEntityNamed('idle_fury'):stop()     
                            end, 0.5)

            self.mouseBlocker:push() 
        end

        if not IsToolApplied('04_fury_hour_glass') then
            self.fury_shout.onFinish:add(function()                                                                                     
                                           -- self:playSound('fury_idle', true)
                                            
                                            self:entityFadeShow('idle_fury')      
                                            self:getEntityNamed('idle_fury'):show()
                                            self:getEntityNamed('idle_fury'):play()

                                             self.timer:add( function()
                                                                self:entityFadeHide('fury_shout')     
                                                             end, 0.15)      

                                            self.timer:add( function()
                                                                self.mouseBlocker:pop()   
                                                            end, 0.5)                                          
                                        end)
        end
    end    


    -- find empty bottle ----------------------------------------------------------------------
    do
        local function on_find_empty_bottle_bag(e)
            self:entityHide(e.target, 'Layer_bottle')            
        end
        self:registerToolFindInfo('05_empty_bottle_bag', 'area_find_empty_bottle_bag', on_find_empty_bottle_bag)    
    end
    -------------------------------------------------------------------------------------------

    -- apply BOTTLE BAG -----------------------------------------------------------------------
    do
        if not IsToolApplied('01_bottle_with_water') then
            self:stopSound('05_fire')
            self:playSound('05_fire', true)
        end

        local function on_apply_bottle_with_water(e)
            self:entityHide(e.target)
            self:entityShow('area_apply_paper')
            self:stopSound('05_fire')           

            if not e.save then
                self:playSound('05_apply_bottle_with_water')
                self:getEntityNamed('Layer_fire'):ChangeOpacity(1, 0, CHANGE_OBJECT_OPACITY)
                 self:getEntityNamed('compositionMAIN_fire'):ChangeOpacity(1, 0, CHANGE_OBJECT_OPACITY)
            else
                self:getEntityNamed('Layer_fire'):hide()
                self:getEntityNamed('compositionMAIN_fire'):hide()
                self:getEntityNamed('compositionMAIN_fire'):stop()
            end
        end
        self:registerToolApplyInfo('01_bottle_with_water', 'area_apply_bottle_with_water', on_apply_bottle_with_water, 'BBT_05_NEED_BOTTLE_WITH_WATER')
    end
    -------------------------------------------------------------------------------------------

    -- apply BOTTLE BAG -----------------------------------------------------------------------
    do
        local function on_apply_paper(e)
            self:entityHide(e.target, 'Layer_coal')
            
            if not e.save then
                self:findTool('05_coal')   
            else
            end
        end
        self:registerToolApplyInfo('04_paper', 'area_apply_paper', on_apply_paper, 'BBT_05_NEED_PAPER')
    end
    -------------------------------------------------------------------------------------------

    -- DEAD BODY
    if not HasGameState('06_Paper_plane_wasfound', 'true') and IsToolFound('04_fury_hour_glass') then
        SetGameState('06_Paper_plane_wasfound', 'true')
        self:getEntityNamed('idle_dead_body'):hide()

        self.skeleton_burn  = createVideo({video = '05_dead_body', sound = '05_dead_body_burn', scale = 1.0, order = 8, x = 91, y = 357, 
                                           isLooped = false, isAlpha = false, isDestroyOnEnd = false})
        self.skeleton_burn:setColor(Colorf(1, 1, 1, 0.7))
        self.skeleton_burn:play()

        self.mouseBlocker:push()
        self.skeleton_burn.onFinish:add( function() 
                                            self.mouseBlocker:pop() 
                                            self:entityHide('idle_fury')     
                                            local fury_speak_02  = createVideo({video = 'fury_speak_2', sound = 'fury_speak_2', scale = 1.5, order = 12, x = 589, y = 235, isLooped = false, isAlpha = true})
                                            self:startCutScene(fury_speak_02 , nil, nil)

                                            local subtitles_1 = nil
                                            subtitles_1 = Subtitles(current_scene:getPanel())
                                            subtitles_1:pushReplic('SUB_05_FURY_SPEAK_2', 0, 4, true)
                                            
                                            subtitles_1:play()

                                            fury_speak_02.onFinish:add( function()
                                                self:getEntityNamed('idle_fury'):show()
                                                self:getEntityNamed('idle_fury'):play()
                                            end)
                                         end)
    elseif IsToolFound('04_fury_hour_glass') then
        self:getEntityNamed('idle_dead_body'):hide()
    end
    -------------------------------------------------------------------------------------------
end

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

function l_05_Forest_path:CreateLoaderTable()
	local objects =
	{
		{ name = 'BG',  entityType = 'SpriteEntity',  x = 512,  y = 384,  order = 0,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/Scenes/05_Forest_path/Layers/BG.jpg',  width = 1366,  height = 768,  },
		{ name = 'area_find_empty_bottle_bag',  entityType = 'SpriteEntity',  x = 187.863,  y = 487.772,  order = 100,  angle = 27,  scaleX = 1.67086,  scaleY = 1.26597,  color = {r = 1, g = 1, b = 1, a = 0.00392157},  editingLocked = false,  treeItemIsExpanded = true,  hotSpot = {x = 64, y = 64},  texturePath = 'Data/Textures/Common/Area_Round.png',  width = 128,  height = 128,  },
		{ name = 'area_apply_bottle_with_water',  entityType = 'SpriteEntity',  x = 726.5,  y = 615,  order = 90,  scaleX = 1.63281,  scaleY = 1.05312,  color = {r = 1, g = 1, b = 1, a = 0.00392157},  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/Common/Area_Round.png',  width = 128,  height = 128,  },
		{ name = 'area_apply_paper',  entityType = 'SpriteEntity',  x = 718,  y = 621.5,  order = 100,  isVisible = false,  scaleX = 1.4,  scaleY = 0.820313,  color = {r = 1, g = 1, b = 1, a = 0.00392157},  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/Common/Area_Round.png',  width = 128,  height = 128,  },
		{ name = 'area_apply_04_fury_hour_glass',  entityType = 'SpriteEntity',  x = 561.5,  y = 230,  order = 70,  color = {r = 1, g = 1, b = 1, a = 0},  editingLocked = false,  treeItemIsExpanded = false,  width = 367,  height = 460,  },
		{ name = 'area_link_06',  entityType = 'SpriteEntity',  x = 642,  y = 204,  order = 102,  scaleX = 2.5,  scaleY = 4,  color = {r = 1, g = 1, b = 1, a = 0.00392157},  editingLocked = false,  treeItemIsExpanded = true,  width = 100,  height = 100,  },
		{ name = 'area_link_04',  entityType = 'SpriteEntity',  x = 536,  y = 722,  order = 80,  scaleX = 12,  scaleY = 2,  color = {r = 1, g = 1, b = 1, a = 0.00392157},  editingLocked = false,  treeItemIsExpanded = true,  width = 100,  height = 121,  },
		{ name = 'layer_furia_mask',  entityType = 'SpriteEntity',  x = 927,  y = 156,  order = 20,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/Scenes/05_Forest_path/Layers/layer_furia_mask.png',  width = 407,  height = 311,  },
		{ name = 'layer_furia_shadow',  entityType = 'SpriteEntity',  x = 587,  y = 460,  order = 70,  scaleX = 0.55,  scaleY = 1.37,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/Scenes/05_Forest_path/Layers/layer_furia_shadow.png',  width = 342,  height = 81,  },
		{ name = 'idle_fury',  entityType = 'VideoEntity',  x = 587,  y = 246,  order = 10,  isRespondable = false,  scale = 1.5,  editingLocked = false,  treeItemIsExpanded = true,  path = 'Data/Video/Scenes/05_Forest_path/idle_fury.webm',  hasAlpha = true,  isLooped = true,  fps = 24,  },
		{ name = 'idle_dead_body',  entityType = 'SpriteEntity',  x = 168,  y = 345,  order = 8,  scaleX = -0.8,  scaleY = 0.8,  color = {r = 1, g = 1, b = 1, a = 0.709804},  editingLocked = false,  treeItemIsExpanded = true,  hotSpot = {x = 208, y = 184},  texturePath = 'Data/Textures/Scenes/05_Forest_path/Layers/idle_dead_body.png',  width = 416,  height = 368,  },
		{ name = 'Layer_bottle',  entityType = 'SpriteEntity',  x = 198,  y = 498,  order = 2,  angle = 15,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/Scenes/05_Forest_path/Layers/Layer_bottle.png',  width = 108,  height = 67,  },
		{ name = 'Layer_fire_Core',  entityType = 'SpriteEntity',  x = 722,  y = 652,  order = 2,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/Scenes/05_Forest_path/Layers/Layer_fire_Core.png',  width = 258,  height = 149,  },
		{ name = 'Layer_fire',  entityType = 'SpriteEntity',  parentName = 'Layer_fire_Core',  x = -7.00006,  y = -17,  order = 4,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/Scenes/05_Forest_path/Layers/Layer_fire.png',  width = 148,  height = 96,  },
		{ name = 'Layer_coal',  entityType = 'SpriteEntity',  parentName = 'Layer_fire_Core',  x = -18.0001,  y = -13,  order = 0,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/Scenes/05_Forest_path/Layers/Layer_coal.png',  width = 48,  height = 34,  },
		{ name = '05_Forest_path_Anim_Room_6_Bg',  entityType = 'CompositionContainer',  x = -171,  y = 0,  order = 6,  editingLocked = false,  treeItemIsExpanded = true,  path = 'Data/Scripts/Scenes/05_Forest_path/Anim/05_Forest_path_Anim_Room_6_Bg.lua',  },
		{ name = 'compositionMAIN',  entityType = 'CompositionSequence',  parentName = '05_Forest_path_Anim_Room_6_Bg',  x = 0,  y = 0,  order = 0,  editingLocked = false,  treeItemIsExpanded = false,  isCyclic = true,  speed = 1,  },
		{ name = '05_Forest_path_Anim_Room_6_Fire',  entityType = 'CompositionContainer',  x = 0,  y = 0,  order = 8,  editingLocked = false,  treeItemIsExpanded = true,  path = 'Data/Scripts/Scenes/05_Forest_path/Anim/05_Forest_path_Anim_Room_6_Fire.lua',  },
		{ name = 'compositionMAIN_fire',  entityType = 'CompositionSequence',  parentName = '05_Forest_path_Anim_Room_6_Fire',  x = 493,  y = 221,  order = 0,  editingLocked = false,  treeItemIsExpanded = false,  isCyclic = true,  speed = 1,  },
	}
	return objects
end
