Merge branch '97-music-flag' into 'development'

Resolve "Music Flag"

Closes #97

See merge request marcel.schwarz/software-projekt-2!116
This commit is contained in:
Marcel Schwarz 2020-06-09 21:48:08 +00:00
commit 79781ccdc9
2 changed files with 3 additions and 1 deletions

View File

@ -56,7 +56,7 @@ class MenuScene: SKScene {
entityManager.add(Background(size: self.size)) entityManager.add(Background(size: self.size))
entityManager.add(SpinningLogoEntity(position: CGPoint(x: midX, y: midY + 200))) entityManager.add(SpinningLogoEntity(position: CGPoint(x: midX, y: midY + 200)))
if SoundManager.sharedInstance.isMusicPlaying == false && SoundManager.sharedInstance.isMusicEnabled == true { if SoundManager.sharedInstance.isMusicPlaying == false && SoundManager.sharedInstance.isMusicEnabled == true && !CommandLine.arguments.contains("--no-music") && !UserDefaults.standard.bool(forKey: "noMusic"){
SoundManager.sharedInstance.startMenuMusic() SoundManager.sharedInstance.startMenuMusic()
} }
} }

View File

@ -29,12 +29,14 @@ class SoundManager {
audioPlayer.prepareToPlay() audioPlayer.prepareToPlay()
if self.isMusicEnabled == true { if self.isMusicEnabled == true {
audioPlayer.play() audioPlayer.play()
UserDefaults.standard.set(false, forKey: "noMusic")
} }
} }
func stopMenuMusic() { func stopMenuMusic() {
audioPlayer.pause() audioPlayer.pause()
self.isMusicPlaying = false self.isMusicPlaying = false
UserDefaults.standard.set(true, forKey: "noMusic")
} }
func setVolume(_ volume: Float) { func setVolume(_ volume: Float) {