
.namespace s01_hotspot

function OnActivate()
	
	OPLog.Log("onactivate "..self.Name)
	if self.Name == "porte_chambre_hotspot" then
		if SampleLevel.IsEqual("s02_firstenter",true) then
			NavigationManager.SwitchTo(nil,"s01_c01")
		else
			NavigationManager.SwitchTo(nil,"s02_SearchSite")
			PlaySoundEffect("gmp_opendoor")
		end
	end
	
	
	
	if self.Name == "porte_bureau_hotspot" then
		if SampleLevel.IsEqual("s04_firstenter",false) then
			NavigationManager.SwitchTo(nil,"s04_SearchSite")
			PlaySoundEffect("gmp_opendoor")
		--elseif SampleLevel.IsEqual("s03_search_3","finished") then
		else
		NavigationManager.SwitchTo(nil,"s01_c02")
			
		end
	end
	if self.Name == "porte_grenier_hotspot" then
		
		if SampleLevel.IsEqual("s02_search_1","finished") and SampleLevel.IsEqual("s01_doorgrenier",true) then
			NavigationManager.SwitchTo(nil,"s03_SearchSite")
			PlaySoundEffect("gmp_opendoor")
		else
			--DisplaySimpleText("GP_100",3) -- "porte fermée"
			SequencePlayer.Enabled = true
			SequencePlayer.PlaySequence("GP_100")
			PlaySoundEffect("gmp_closedoor")

		end
	end
	
	if self.Name == "porte_parent_hotspot" then
		SequencePlayer.Enabled = true
		SequencePlayer.PlaySequence("GP_105")
		PlaySoundEffect("gmp_closedoor")
		
	
	end

	if self.Name == "OpenPostit" then
		NewTutorialManager.ClosePopupTuto()
		SampleLevel.Set("s01_postitread",true)
		PlaySoundEffect("gmp_grabpaper")
		DocumentManager.OpenDocument("media/graph/documents/post-it_"..DebugOptions.curlanguage..".PNG","post-it","none")

	end	
	if self.Name == "start_help_closeup" then
	-- SearchInterface.Enabled = true
		start_help.Enabled = false
		SequencePlayer.Enabled = true
		SequencePlayer.PlaySequence("GP_108",nil,nil)
		SampleLevel.Set("s01_firstenter",false)
	end	
	
end



function OnEnable()
	AreaHotspot.OnEnable()
	--self.firstclick = true
	OPLog.Log("mon onenable "..self.Name)
end

function PrivateCanClickOn()
	--if SampleLevel.IsEqual("CloseupMecaState","finished")  then
	--	return false
	--end
	
	if IsEqualVariables("CurrentGamePhase","Tutorial") and NewTutorialManager.g_message == "TU_01" and self.Name == "OpenPostit"  then
		 return true
	elseif IsEqualVariables("CurrentGamePhase","Tutorial") and NewTutorialManager.g_message == "TU_08" and self.Name == "porte_grenier_hotspot"  then
		 return true	 
	elseif  IsEqualVariables("CurrentGamePhase","Tutorial") then
		return false
	end
	
	return true
end

function GetSpecificCursor()
	if self.Name == "porte_parent_hotspot" then
		return 4,"chambre_parents"
	elseif self.Name == "porte_grenier_hotspot" then
		return 4,"s03"
	elseif self.Name == "porte_chambre_hotspot" then
		return 4,"s02"
	elseif self.Name == "porte_bureau_hotspot" then
		return 4,"s04"			
	elseif self.Name == "OpenPostit" then
		return 5
	elseif self.Name == "ClosePostit" then
		return 		
	else
		return CURSOR_AREA_HOTSPOT
	end
end
function OnDropObject()
	OPLog.Log("drop "..self.Name)
	if IsEqualVariables("CurrentObject","InventoryClefGrenier") and self.Name == "porte_grenier_hotspot" then
		NewTutorialManager.ClosePopupTuto()
		porte_grenier_anim.Play()
		SampleLevel.Set("s01_doorgrenier",true)
		InventoryManager.RemoveFromInventory("InventoryClefGrenier")
		PlaySoundEffect("gmp_openkey")
		return true
	end
	return false
end