33 lines
816 B
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

--- @class Audio
--- @field musicVolume number
--- @field soundVolume number
audio = {}
audio.__index = audio
local function new(musicVolume, soundVolume) -- здесь мы должны выгружать значения из файлика с сохранением настроек
return setmetatable({
musicVolume = musicVolume,
soundVolume = soundVolume
}, audio)
end
--- @param source love.Source
function audio:play(source)
if source:getType() == "static" then
source:setVolume(self.musicVolume)
return source:play()
end
source:setVolume(self.soundVolume)
return source:play()
end
function audio:setMusicVolume(volume)
self.musicVolume = volume
end
function audio:setSoundVolume(volume)
self.soundVolume = volume
end
return { new = new }