Add --no-music flag, Implement NSUserDefaults for music settings
This commit is contained in:
parent
46fa90bfe3
commit
2f32943511
@ -56,7 +56,7 @@ class MenuScene: SKScene {
|
||||
entityManager.add(Background(size: self.size))
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
@ -29,12 +29,14 @@ class SoundManager {
|
||||
audioPlayer.prepareToPlay()
|
||||
if self.isMusicEnabled == true {
|
||||
audioPlayer.play()
|
||||
UserDefaults.standard.set(false, forKey: "noMusic")
|
||||
}
|
||||
}
|
||||
|
||||
func stopMenuMusic() {
|
||||
audioPlayer.pause()
|
||||
self.isMusicPlaying = false
|
||||
UserDefaults.standard.set(true, forKey: "noMusic")
|
||||
}
|
||||
|
||||
func setVolume(_ volume: Float) {
|
||||
|
Loading…
Reference in New Issue
Block a user