Add possibility to disable sound effects
This commit is contained in:
parent
9b1ff1d4ae
commit
58f6032e06
@ -38,6 +38,7 @@ class SoundManager {
|
||||
}
|
||||
|
||||
func playSoundEffect(pathToFile: String, fileExtension: String, volumeLevel: Float){
|
||||
self.isMusicPlaying = true
|
||||
soundEffect = Bundle.main.url(forResource: pathToFile, withExtension: fileExtension)
|
||||
do {
|
||||
effectPlayer = try AVAudioPlayer(contentsOf: soundEffect!)
|
||||
@ -45,7 +46,11 @@ class SoundManager {
|
||||
os_log("Could not load sound file %@", log: LOG, type: .error, pathToFile)
|
||||
}
|
||||
effectPlayer.volume += volumeLevel
|
||||
effectPlayer.prepareToPlay()
|
||||
if self.isMusicEnabled == true {
|
||||
effectPlayer.play()
|
||||
UserDefaults.standard.set(false, forKey: "noMusic")
|
||||
}
|
||||
}
|
||||
|
||||
func stopMenuMusic() {
|
||||
|
Loading…
Reference in New Issue
Block a user