
.namespace hotspotclefs

function OnActivate()
	--OPLog.Log(" tempsquipasse "..tempsquipasse)
	
	for i=1,6  do 
	
		if i==1 then
			at=tabclef1
		elseif i==2 then
			at=tabclef2
		elseif i==3 then
			at=tabclef3
		elseif i==4 then
			at=tabclef4
		elseif i==5 then
			at=tabclef5
		elseif i==6 then
			at=tabclef6
		end
	
		if self.Name == "clef"..tostring(i).."_Hotspot" then
			OnMouseOff()
			clefaenfonce=i
			cleftenue=0
			transtart=1
			
			-- if cleftenue==0 then
				-- cleftenue=i
			-- elseif cleftenue==i then
				-- ct.Position_X = tabposX[tabindicepos[cleftenue]] 
				-- ct.Position_Y = tabposY[tabindicepos[cleftenue]] 
				-- cleftenue=0
			-- end
			tabcleprise = at
		end
	
		if self.Name == "serrure_Hotspot" and cleftenue==i then
			clefaenfonce=i
			cleftenue=0
			transtart=1
		end
	end

	
end

function OnMouseOn()
	if not self.CanClickOn()  then
		return
	end

	for i=1,6  do 
		if self.Name == "clef"..tostring(i).."_Hotspot" then
			clefover = OPUnitFactory.GetUnit("clef"..tostring(i))
			clefover.SetFrame(1)
		end
	end
end

function OnMouseOff()
	for i=1,6  do 
		if self.Name == "clef"..tostring(i).."_Hotspot" then
			clefover = OPUnitFactory.GetUnit("clef"..tostring(i))
			clefover.SetFrame(0)
		end
	end
end

function OnEnable()
	AreaHotspot.OnEnable()
	
end

function GetSpecificCursor()
	if self.Name=="clefsBegin_hotspot" then
		return 0
	else
		return 3
	end
end

function PrivateCanClickOn()
	
	if transtart==2 or cond2>0 then
		return false
	else return true
	end
end

function OnDropObject()
	OPLog.Log("drop "..self.Name)
	if IsEqualVariables("CurrentObject","InventoryClefs") and self.Name == "clefsBegin_hotspot" then
		PlaySoundEffect("gmp_dropkeys")
		SampleLevel.Set("s09_c02_clefs",true)
		InventoryManager.RemoveFromInventory("InventoryClefs")
		gamestart=true
		clefsBegin_hotspot.Enabled=false
		clef1.Enabled=true
		clef2.Enabled=true
		clef3.Enabled=true
		clef4.Enabled=true
		clef5.Enabled=true
		clef6.Enabled=true
		SequencePlayer.PlaySequence("AI_"..GetCurrentManager().Name,s09_c02,nil,"help")
		return true
	end
	return false
end
