
.namespace s01_SearchSite

function OnEnable()
	SearchSite.OnEnable()
	OPLog.Log("OnEnable unit "..self.Name)
	
	--On affiche les portes ouvertes si elles le sont
	if SampleLevel.IsEqual("s02_firstenter",false) then
			porte_ouverte_chambre.Flags_Visible = true
			else
			porte_ouverte_chambre.Flags_Visible = false
	end
	if SampleLevel.IsEqual("s04_firstenter",false) then
			porte_ouverte_bureau.Flags_Visible = true
			else
			porte_ouverte_bureau.Flags_Visible = false
	end	
	if SampleLevel.IsEqual("s01_doorgrenier",true) then
			porte_grenier_anim.Flags_Visible = true
			porte_grenier_anim.SetFrame(10)
			else
			porte_grenier_anim.Flags_Visible = false
	end	
	
	
end


function OnUpdate()
	--OPLog.Log("test")
end

function OnEnter() 
	if SampleLevel.IsEqual("s01_firstenter",true) then
		SampleLevel.Set("s01_firstenter",false)
		PopupManager.OpenPopupYN("msg_ig_tuto",nil)
	end	
	if  UserData.IsEqual("displayTutorial", true) then
		if InventoryClefGrenier.Equipped == true then
		
		NewTutorialManager.OpenPopupTuto("TU_08",nil,170,522,"waitforaction")
		popups_tuto.SetFrame(0)
		end
	end
end

function OnSequenceEnd(keyword)
	if  UserData.IsEqual("displayTutorial", true) then
		if keyword == "GP_108" then
			NewTutorialManager.OpenPopupTuto("TU_01",nil,506,292,"waitforaction")
			popups_tuto.SetFrame(0)
		end
	end
end

function OnPopupYNLeave(popupansw, message)
		if popupansw then
			UserData.Set("displayTutorial", true)
		else
			UserData.Set("displayTutorial", false)
		end
		SequencePlayer.Enabled = true
		SequencePlayer.PlaySequence("GP_108",s01_SearchSite,nil)

end

function OnPickObject(objname)
		
end

function OnSearchEnd(typesearch)

end

function CondSpecificToFinish()

end

-- function OnPopupTutoLeave(message)
-- OPLog.Log("test"..message)
	-- if  UserData.IsEqual("displayTutorial", true) then
		-- if message == "TU_01" then
			-- NewTutorialManager.OpenPopupTuto("TU_02",nil,611,99,3)
		-- end
	-- end
-- end