
.namespace s17_SearchSite

function OnEnable()
	SearchSite.OnEnable()
	OPLog.Log("OnEnable unit "..self.Name)
	--On définit le nom du tableau
end

function OnEnter()
	if SampleLevel.IsEqual("s17_firstenter",true) then
		SequencePlayer.Enabled = true
		SequencePlayer.PlaySequence("GP_1701",nil,nil)
		SampleLevel.Set("s17_firstenter",false)
	end	
	if SampleLevel.IsEqual("s17_c01_win",true) and SampleLevel.IsEqual("s18_firstenter",true)  then
	coffre_anim.Play(self)
	coffre.Enabled = false
	PlaySoundEffect("gmp_opensafe")
	end
	if SampleLevel.IsEqual("s18_firstenter",false) then
	coffre_anim.SetFrame(34)
	--SequencePlayer.PlaySequence("GP_1713",self,nil)
	end
end


function UpdateAll()
	
end
count_list_1 = 0
function OnPickObject(objname)
	if objname == "obj_sablier" then
		SequencePlayer.Enabled = true
		SequencePlayer.PlaySequence("GP_1703",nil,nil)
	end
	if  SampleLevel.IsEqual("s17_search_1","started") then
		count_list_1 =count_list_1 + 1
		if count_list_1 == 1 then
			SequencePlayer.Enabled = true
			SequencePlayer.PlaySequence("GP_1707",nil,nil)
		end
		if count_list_1 == 4 then
			SequencePlayer.Enabled = true
			SequencePlayer.PlaySequence("GP_1708",nil,nil)
		end
	end
end

 -- function OnSequenceEnd (keyword)
	 -- if keyword == "GP_1701" then
	  -- NavigationManager.SwitchTo(nil,"s18_SearchSite")
   -- end
  -- end

function OnSearchEnd(typesearch)
	if typesearch == 1 then
		InventoryManager.AddInInventory("InventoryBouchons","msg_ig_inventaire")
		InventoryTube.Equipped = true
	end
	if typesearch == 3 then
		InventoryManager.AddInInventory("InventoryReservoir","msg_ig_inventaire")
		InventoryReservoir.Equipped = true
	end
end
function OnPopupLeave(objname)
	if objname == "InventoryReservoir" then
		SequencePlayer.Enabled = true
		SequencePlayer.PlaySequence("GP_1706",nil,nil)
	end
	if objname == "InventoryBouchons" then
		SequencePlayer.Enabled = true
		SequencePlayer.PlaySequence("GP_1709",nil,nil)
	end
end
function OnAnimationEnd ()
SequencePlayer.PlaySequence("GP_1713",self,nil)
end

function OnSequenceEnd(keyword)
		if keyword == "GP_1713" then
		NavigationManager.SwitchTo(nil,"s18_SearchSite")
		end
end
function CondSpecificToFinish()

end