-- ----------------------------------------------------------------------------
layoutBasement.mExits =
{
	[objectBasementDoorLit] = 
	{
		target = layoutLivingroom,
		targetPageH = kRight,
		mirrors = {objectBasementDoorUnlit},
		arrowX = 283,
		arrowY = 285,
		arrowAngle = 0.05 * math.pi,
		labelX = 277,
		labelY = 394,
		labelAnchorpoint = ANCHOR_CENTER,
	},
}
layoutBasement.mPOIs = 
{
	[objectBasementDarkcornerLit] = 
	{	
		target = layoutBasementCorner,
		mirrors = {objectBasementDarkcornerUnlit},
		sparkleX = 398,
    	sparkleY = 472,	
	},
	[objectBasementFuseboxUnlit] = 
	{	
		target = layoutBasementFusebox,
		mirrors = {objectBasementFuseboxLit},
	},
	[objectBasementSecretdoorLit] = 
	{	
		target = layoutBasementSecretDoor,
		mirrors = {objectBasementSecretdoorUnlit},
	},
	[objectPoiBasementPaper] = 
	{	
		target = layoutBasementPaper,
	},	
}
layoutBasement.mHOs = 
{
	[objectPorchFuse2] = 
	{
		siblings = {objectPorchFuse2Dark},
	},
	[objectBasementFuse5] = 
	{
		siblings = {objectBasementFuse5Dark, objectBasementFuse5Pocket},
	},
	[objectBasementFuse6] = 
	{
		siblings = {objectBasementFuse6Dark, objectBasementFuse6Pocket},
	},
	[objectBasementWrench] = 
	{
		siblings = {objectBasementWrenchLit, objectBasementWrenchUnlit},
	},
	[objectBedroomCandle] = 
	{
		siblings = {objectBedroomCandleDark, objectBedroomCandleLight},
	},
}
layoutBasement.mIOs =
{
}
-- ----------------------------------------------------------------------------
function layoutBasement:onConstruct()

	Layout.onConstruct(self)
	
	objectBasementSecretdoorLit:ss(kInactive)
	objectBasementSecretdoorUnlit:ss(kActive)
	
	objectBasementSecretdoorPeepLit:ss(kInactive)
	objectBasementSecretdoorPeepLit:animate("flickerPeepLit",
		{ startframe=0, endframe=4,	frametime=100, loops="forever" }
	)	
	objectBasementSecretdoorPeep:ss(kActive)
	objectBasementSecretdoorPeep:animate("flickerPeep",
		{ startframe=0, endframe=4,	frametime=100, loops="forever" }
	)	
	
	objectBasementDoorLit:ss(kInactive)
	objectBasementDoorUnlit:ss(kActive)
	objectBasementDarkcornerLit:ss(kInactive)
	objectBasementBackgroundLit:ss(kInactive)
	objectBedroomCandleLight:ss(kInactive)
	objectBasementFuseboxLight:ss(kInactive)
	objectPoiBasementPaper:ss(kInactive)
	objectBasementPaper:ss(kInactive)
	objectBasementFuseboxSpark01:ss(kInactive)
	objectBasementFuseboxSpark02:ss(kInactive)

	self:animPaper()

end
-- ----------------------------------------------------------------------------
function layoutBasement:onClickHO(object, x, y)	

	if (object == objectBedroomCandle and objectBedroomCandle:isActive()) then
		objectBedroomCandleLight:ss(kDone)
	end
	
	return Layout.onClickHO(self, object, x, y)

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

	Layout.onAnimationFinish(self, animationName)

	if (animationName == "flapPaperBasement") then
		self:animPaper()
	
	elseif (animationName == "fuseboxSpark01Shine") then
		self:animSpark01()
	
	elseif (animationName == "fuseboxSpark02Shine") then
		self:animSpark02()
	
	end
	
end
-- ----------------------------------------------------------------------------
function layoutBasement:shouldPlaceFireflies()

	if (Layout.shouldPlaceFireflies(self)) then
    	return layoutBasementFusebox:isSolved()
    end

end
-- ----------------------------------------------------------------------------
function layoutBasement:animPaper()

	objectBasementPaper:animate("flapPaperBasement",
		{ delay = math.random(1500, 3000) },
		{ startframe=0, endframe=8, frametime=100 }
	)	

end
-- ----------------------------------------------------------------------------
function layoutBasement:animSpark01()

	if (objectBasementFuseboxSpark01:isIdle()) then
		objectBasementFuseboxSpark01:setVisible(false)
		objectBasementFuseboxSpark01:animate("fuseboxSpark01Shine",
			{ delay = math.random(3000, 7000) },
			{ visible = true },
			{ startframe=0, endframe=1, frametime=75 },
			{ visible = false }
		)
	end

end
-- ----------------------------------------------------------------------------
function layoutBasement:animSpark02()

	if (objectBasementFuseboxSpark02:isIdle()) then
		objectBasementFuseboxSpark02:setVisible(false)
		objectBasementFuseboxSpark02:animate("fuseboxSpark02Shine",
			{ delay = math.random(5000, 11000) },
			{ visible = true },
			{ startframe=0, endframe=3, frametime=75 },
			{ visible = false }	
		)		
	end

end
-- ----------------------------------------------------------------------------
function layoutBasement:onStartAudio()

	playAmbientAudio(kInsideHutAmbientGroup)
	
	local trackProperties = {}
	trackProperties.tag = "BASEMENT_WATER"
	trackProperties.definition = "BASEMENT_WATER_DRIP"
	trackProperties.volume = 0.4
	getAudioManager():playTrack(trackProperties)
	
	if (layoutBedroom ~= nil) then
		layoutBedroom:checkRadioStatic("soft")
	end
end
-- ----------------------------------------------------------------------------
function layoutBasement:onStopAudio()

	stopAudioTrack("BASEMENT_WATER")
	
end