
.namespace s08_SearchSite

function OnEnable()
	SearchSite.OnEnable()
	OPLog.Log("OnEnable unit "..self.Name)
		if  SampleLevel.IsEqual("s08_search_1","unstarted") then 
		sorti_hotspot.Enabled = true
		end
end

function OnEnter()
	
	if SampleLevel.IsEqual("s08_firstenter",true)   then
		NavigationManager.SwitchTo(nil,"s08_c01")
		SampleLevel.Set("s08_firstenter",false)
	elseif not SampleLevel.IsEqual("s07_c01_search_6","finished") then
		SequencePlayer.Enabled = true
		SequencePlayer.PlaySequence("GP_805",nil,nil)
	end
	
	if SampleLevel.IsEqual("s08_search_1","unstarted") and SampleLevel.IsEqual("s07_c01_search_6","finished")  then
		inis08 = 0
	else 
		inis08=-1
	end
end


function UpdateAll()
end
function OnUpdate()
	 if inis08 ==0 then
		 tempsdeparts08= OPTime.GetTime()
		 inis08 = 1
	 elseif inis08 == 1 then
		tempsquipasses08 = OPTime.GetTime() - tempsdeparts08
		if tempsquipasses08 > 10 and SampleLevel.IsEqual("s08_search_1","unstarted") and IsEqualVariables("CurrentGamePhase","SearchSite") then
			inis08 = -1
			SequencePlayer.Enabled = true
			SequencePlayer.PlaySequence("GP_801",nil,nil)
		end
	 end

end

function OnPickObject(objname)


end

function OnSearchEnd(typesearch)
	if typesearch == 1 then
	InventoryManager.AddInInventory("InventoryEchelles08","msg_ig_inventaire")
	InventoryEchelles08.Equipped = true
	end
	
	
end

function OnPopupLeave(objname)
	if objname == "InventoryEchelles08" then
		SequencePlayer.Enabled = true
		SequencePlayer.PlaySequence("GP_806",nil,nil)
	end
end

function OnDocumentLeave(docname)


end

function OnDocumentUse(docname)
	if docname == "InventoryLettre" then
			OPLog.Log("Test : OnDocumentLeave fonctionne")
		if  SampleLevel.IsEqual("s08_search_1","unstarted") then
			@ObjectManager.LaunchNewResearch("s08",1)
			SequencePlayer.Enabled = true
			SequencePlayer.PlaySequence("GP_802",nil,nil)
			InventoryManager.RemoveFromInventory("InventoryLettre")
			return true
		end

	end
	return false
end

function CondSpecificToFinish()

end