layoutWoods1.showShadowScare = false
-- ----------------------------------------------------------------------------
layoutWoods1.mExits =
{
	[objectExitWoods1Lakeside] = 
	{
		target = layoutLakeside,
		arrowX = 323,
		arrowY = 291,
		arrowAngle = 1.8 * math.pi,
		labelX = 304,
		labelY = 221,
		labelAnchorpoint = ANCHOR_CENTER_LEFT,
	},
	[objectExitWoods1Woods2] = 
	{
		target = layoutWoods2,
		arrowX = 1117,
		arrowY = 335,
		arrowAngle = 0.24 * math.pi,
		labelX = 1183,
		labelY = 258,
		labelAnchorpoint = ANCHOR_CENTER_RIGHT,
	},
	[objectExitWoods1Loverslane] = 
	{
		target = layoutCar2,
		arrowX = 391,
		arrowY = 550,
		arrowAngle = 0.25 * math.pi,
		labelX = 413,
		labelY = 483,
		labelAnchorpoint = ANCHOR_CENTER_LEFT,
	},
}

layoutWoods1.mPOIs = 
{
	[objectPoiEngine] = 
	{
		target = layoutWoods1Engine,
		mirrors = {objectPoiEngineOpen},
	},
	[objectPoiKiosk] = 
	{
		target = layoutWoods1Kiosk,
		sparkleX = 198,
    	sparkleY = 301,	
	},
	[objectPoiTireFlat] = 
	{
		target = layoutWoods1Tirechange,
	},
	[objectPoiTrunkOpen] = 
	{
		target = layoutWoods1Trunk,
		mirrors = {objectIoTrunkClosed},
	},
}

layoutWoods1.mHOs = 
{
	[objectHoPanel01] = 
	{
		siblings = {objectHoPanel01Lit, objectHoPanel01Pocket}
	},
}
layoutWoods1.mEffectRadiatorSmoke     = nil
layoutWoods1.mEffectMosquitosKiosk    = nil
layoutWoods1.mEffectMosquitosCarlight = nil
-- ----------------------------------------------------------------------------
function layoutWoods1:onConstruct()
	
	Layout.onConstruct(self)
	
	objectPoiTrunkOpen:ss(kInactive)
	
	self.mEffectRadiatorSmoke 	  = self:newChildParticle( { name = "PARTICLE_RADIATOR_SMOKE", x=375, y=396, library="PARTICLE_WOODS1_CAR_ENGINE_SMOKE_LAYOUT", section="particles", play=false, removeWhenFinished=false } )
	self.mEffectMosquitosKiosk    = self:newChildParticle( { name = "PARTICLE_WOODS1_KIOSK_MOSQUITOS", x=204, y=279, library="PARTICLE_LAMP_MOSQUITOS", section="particles", play=true, removeWhenFinished=false } )
	self.mEffectMosquitosCarlight = self:newChildParticle( { name = "PARTICLE_WOODS1_CARLIGHTS_MOSQUITOS", x=284, y=447, library="PARTICLE_LAMP_MOSQUITOS", section="particles", play=false, removeWhenFinished=false } )
	
end
-- ----------------------------------------------------------------------------
function layoutWoods1:onInitialize()

	Layout.onInitialize(self)
	
	objectExitWoods1Lakeside:ss(kActive)
	objectExitWoods1Woods2:ss(kActive)
	
	objectPoiKiosk:ss(kActive)
	objectPoiTireFlat:ss(kInactive)
	
	objectFireLakeside:ss(kInactive)
	
	objectTireFlatNoPanel:ss(kInactive)
	objectTireFlatPanel:ss(kInactive)
	objectTireFlatPanelOldWheelOn:ss(kInactive)
	objectTireFlatPanelOldWheelOff:ss(kInactive)
	objectTireFlatNewWheelOn:ss(kInactive)
	objectTireFlatFixed:ss(kInactive)
	objectPoiEngineOpen:ss(kInactive)
	
	objectBackgroundWoods1LeftDark:ss(kInactive)
	objectBackgroundWoods1CenterDark:ss(kInactive)
	objectBackgroundWoods1RightDark:ss(kInactive)
	
	objectScareWoods1ShadowyFigureStart:ss(kInactive)
	objectScareWoods1ShadowyFigure:ss(kInactive)
	
	objectKioskFlashLight:ss(kInactive)
	objectKioskFlashLight:setAlpha(0)
	objectKioskFlashLightDark:ss(kInactive)
	objectKioskFlashLightDark:setAlpha(0)
	self:flickerKioskLight()

end
-- ----------------------------------------------------------------------------
function layoutWoods1:checkShadowScare()

	if (self.showShadowScare == true and not objectScareWoods1ShadowyFigureStart:isDone()) then
		
		self.showShadowScare = false
		
		objectScareWoods1ShadowyFigureStart:ss(kIdle)
		
		objectScareWoods1ShadowyFigureStart:animate("scareShadowWoods1_blocking",
			{ command="playTrack track=SHADOW_SCARE_1", target=self },
			{ alpha=1, duration=2000	}
		)
		
	end

end
-- ----------------------------------------------------------------------------
function layoutWoods1:onAnimationFinish(animationName)

	Layout.onAnimationFinish(self, animationName)
		
	if (animationName == "scareShadowWoods1_blocking") then
		
		objectScareWoods1ShadowyFigureStart:ss(kDone)
	
		objectScareWoods1ShadowyFigure:ss(kIdle)
		objectScareWoods1ShadowyFigure:animate("scareShadowWoods1Run_blocking",
			{ startframe=0, endframe=11,		frametime=100	}	
		)
	
	elseif (animationName == "scareShadowWoods1Run_blocking") then
	
		objectScareWoods1ShadowyFigure:ss(kDone)
		
	elseif (animationName == "flickerKioskLight") then
		
		self:flickerKioskLight()
		
	end
	
end
-- ----------------------------------------------------------------------------
function layoutWoods1:flickerKioskLight()

	objectKioskFlashLight:ss(kInactive)
	objectKioskFlashLightDark:ss(kInactive)

	local flickerObject = objectKioskFlashLight
	if (goalLightFire:isFinished()) then
		flickerObject = objectKioskFlashLightDark
	end
	
	flickerObject:ss(kActive)
	flickerObject:animate("flickerKioskLight",
		{ delay = math.random(6000, 8000) },
		{ alpha = 1, duration = 50 },
		{ delay = math.random(50, 100) },
		{ alpha = 0, duration = 50 },
		{ delay = math.random(50, 100) },
		{ alpha = 1, duration = 50 },
		{ delay = math.random(50, 100) },
		{ alpha = 0, duration = 50 },
		{ delay = math.random(50, 100) },
		{ alpha = 1, duration = 50 },		
		{ delay = math.random(50, 100) },
		{ alpha = 0, duration = 50 }
	)

end
-- ----------------------------------------------------------------------------
function layoutWoods1:onMovieFinish(movieName)

	Layout.onMovieFinish(self, movieName)

	if (movieName == kMovieEnd) then
		endStory()	
	end

end

-- ----------------------------------------------------------------------------
function layoutWoods1:onStartAudio()

	-- Play some outside noises
	playAmbientAudio(kOutsideHutAmbientGroup)
	
	-- Sweeteners
	local tempTrack = {}
	
	tempTrack.group = kOutsideHutAmbientGroup
	tempTrack.volume = 1.0
	
	tempTrack.tag = "TREES"
	tempTrack.definition = "TREE_SWEETENER_1"
	getAudioManager():playTrack(tempTrack)
	
	tempTrack.tag = "CONES"
	tempTrack.definition = "PINECONE_FALL"
	getAudioManager():playTrack(tempTrack)
	
	tempTrack.tag = "TWIGS"
	tempTrack.definition = "TWIG_CRACK"
	getAudioManager():playTrack(tempTrack)
	
end

-- ----------------------------------------------------------------------------
function layoutWoods1:onStopAudio()
	stopAudioTrack("TREES")
	stopAudioTrack("CONES")
	stopAudioTrack("TWIGS")
end
-- ----------------------------------------------------------------------------
function layoutWoods1:animFireOn()

	objectFireLakeside:ss(kIdle)
	objectFireLakeside:animate("animFireOnWoods1",
		{ startframe=0, endframe=6,	frametime=150, loops="forever" }
	)			

end