--OPLua.Include('Framework/UnitManager.lua')

-- en fait c'est de la classe SimpleSound

.namespace SimpleSound


function OnEnable()

	self.UserUnitNotify = nil
	--g_MoveCamOnly = false
    
end


function SetUserUnitNotify(ut)

	self.UserUnitNotify = ut
  
end


function OnEndSound()

	if self.Type == "music" then
		OPLog.Log("End de "..self.Name)
	end
	
	--[[
	if g_MoveCamOnly then
		g_MoveCamOnly = false
		SetVariables('CurrentGamePhase', 'Game')
	end
	--]]
	
	self.Finished=true
	 
	if self.UserUnitNotify ~= nil then
		self.UserUnitNotify.OnSoundEnd(self.Name)
	end
	
	OPUnitFactory.GetUnit("SoundPlayer",'Unit').OnSoundEnd(self.Name,self)
	
    --self.Stop()
   
    OPUnitFactory.CloseUnit(self)
    
end


function OnDisable()

    --OPLog.Log('AUTO-DISABLE du son : ' .. self.Name)
    if (self.UnitNotify ~= nil and self.UnitNotify~= nil and self.UnitNotify.Enabled == true ) then
        --OPLog.Log('------------>>>> On appelle OnSimpleSoundEnd')
        self.UnitNotify.OnSimpleSoundEnd(self.Name)

    end
    
end


--[[
function SetMoveCamOnly()

	g_MoveCamOnly = true

end


function GetMoveCamOnly()

	return g_MoveCamOnly

end
--]]


