Merge branch '100-soundeffekte' into 'development'
Resolve "Soundeffekte" Closes #100 See merge request marcel.schwarz/software-projekt-2!118
This commit is contained in:
commit
5d89636ebd
@ -16,6 +16,9 @@
|
|||||||
110360EE244B101B008610AF /* GoldWarsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 110360ED244B101B008610AF /* GoldWarsTests.swift */; };
|
110360EE244B101B008610AF /* GoldWarsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 110360ED244B101B008610AF /* GoldWarsTests.swift */; };
|
||||||
11036113244B3E30008610AF /* MenuScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11036112244B3E30008610AF /* MenuScene.swift */; };
|
11036113244B3E30008610AF /* MenuScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11036112244B3E30008610AF /* MenuScene.swift */; };
|
||||||
116060F7245C57D2004E5A36 /* EntityManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 116060F6245C57D2004E5A36 /* EntityManager.swift */; };
|
116060F7245C57D2004E5A36 /* EntityManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 116060F6245C57D2004E5A36 /* EntityManager.swift */; };
|
||||||
|
205ED9CB249507E200B28718 /* use_boost.wav in Resources */ = {isa = PBXBuildFile; fileRef = 205ED9C8249507E200B28718 /* use_boost.wav */; };
|
||||||
|
205ED9CC249507E200B28718 /* attack_base.wav in Resources */ = {isa = PBXBuildFile; fileRef = 205ED9C9249507E200B28718 /* attack_base.wav */; };
|
||||||
|
205ED9CD249507E200B28718 /* new_round.wav in Resources */ = {isa = PBXBuildFile; fileRef = 205ED9CA249507E200B28718 /* new_round.wav */; };
|
||||||
3E67854024728368007B9DE4 /* CElements.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E67853F24728368007B9DE4 /* CElements.swift */; };
|
3E67854024728368007B9DE4 /* CElements.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E67853F24728368007B9DE4 /* CElements.swift */; };
|
||||||
3E6785422472CBEC007B9DE4 /* Way.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E6785412472CBEC007B9DE4 /* Way.swift */; };
|
3E6785422472CBEC007B9DE4 /* Way.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E6785412472CBEC007B9DE4 /* Way.swift */; };
|
||||||
3EAD889524801B6A0048A10A /* RoundTimer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EAD889424801B6A0048A10A /* RoundTimer.swift */; };
|
3EAD889524801B6A0048A10A /* RoundTimer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EAD889424801B6A0048A10A /* RoundTimer.swift */; };
|
||||||
@ -81,6 +84,9 @@
|
|||||||
110360EF244B101B008610AF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
110360EF244B101B008610AF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
11036112244B3E30008610AF /* MenuScene.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuScene.swift; sourceTree = "<group>"; };
|
11036112244B3E30008610AF /* MenuScene.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuScene.swift; sourceTree = "<group>"; };
|
||||||
116060F6245C57D2004E5A36 /* EntityManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EntityManager.swift; sourceTree = "<group>"; };
|
116060F6245C57D2004E5A36 /* EntityManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EntityManager.swift; sourceTree = "<group>"; };
|
||||||
|
205ED9C8249507E200B28718 /* use_boost.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = use_boost.wav; sourceTree = "<group>"; };
|
||||||
|
205ED9C9249507E200B28718 /* attack_base.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = attack_base.wav; sourceTree = "<group>"; };
|
||||||
|
205ED9CA249507E200B28718 /* new_round.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = new_round.wav; sourceTree = "<group>"; };
|
||||||
3E67853F24728368007B9DE4 /* CElements.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CElements.swift; sourceTree = "<group>"; };
|
3E67853F24728368007B9DE4 /* CElements.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CElements.swift; sourceTree = "<group>"; };
|
||||||
3E6785412472CBEC007B9DE4 /* Way.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Way.swift; sourceTree = "<group>"; };
|
3E6785412472CBEC007B9DE4 /* Way.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Way.swift; sourceTree = "<group>"; };
|
||||||
3EAD889424801B6A0048A10A /* RoundTimer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoundTimer.swift; sourceTree = "<group>"; };
|
3EAD889424801B6A0048A10A /* RoundTimer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoundTimer.swift; sourceTree = "<group>"; };
|
||||||
@ -165,6 +171,9 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
C04783ED2468583F004961FB /* intro-music.mp3 */,
|
C04783ED2468583F004961FB /* intro-music.mp3 */,
|
||||||
|
205ED9C9249507E200B28718 /* attack_base.wav */,
|
||||||
|
205ED9CA249507E200B28718 /* new_round.wav */,
|
||||||
|
205ED9C8249507E200B28718 /* use_boost.wav */,
|
||||||
9ECD3699245C91F7008DEEBD /* GoldWars.entitlements */,
|
9ECD3699245C91F7008DEEBD /* GoldWars.entitlements */,
|
||||||
9E11FF74245CD79100EED3BE /* Partikels */,
|
9E11FF74245CD79100EED3BE /* Partikels */,
|
||||||
116060F5245C5709004E5A36 /* Entities */,
|
116060F5245C5709004E5A36 /* Entities */,
|
||||||
@ -370,13 +379,16 @@
|
|||||||
isa = PBXResourcesBuildPhase;
|
isa = PBXResourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
205ED9CD249507E200B28718 /* new_round.wav in Resources */,
|
||||||
110360DE244B101A008610AF /* Main.storyboard in Resources */,
|
110360DE244B101A008610AF /* Main.storyboard in Resources */,
|
||||||
9E11FF79245CD81100EED3BE /* Fire.sks in Resources */,
|
9E11FF79245CD81100EED3BE /* Fire.sks in Resources */,
|
||||||
110360E0244B101B008610AF /* Assets.xcassets in Resources */,
|
110360E0244B101B008610AF /* Assets.xcassets in Resources */,
|
||||||
110360E3244B101B008610AF /* LaunchScreen.storyboard in Resources */,
|
110360E3244B101B008610AF /* LaunchScreen.storyboard in Resources */,
|
||||||
9E61EAC4249BAC9100334DDE /* LoserFire.sks in Resources */,
|
9E61EAC4249BAC9100334DDE /* LoserFire.sks in Resources */,
|
||||||
C04783EE2468583F004961FB /* intro-music.mp3 in Resources */,
|
C04783EE2468583F004961FB /* intro-music.mp3 in Resources */,
|
||||||
|
205ED9CC249507E200B28718 /* attack_base.wav in Resources */,
|
||||||
3F79FFE02486F7CD003F79C3 /* Explosion.sks in Resources */,
|
3F79FFE02486F7CD003F79C3 /* Explosion.sks in Resources */,
|
||||||
|
205ED9CB249507E200B28718 /* use_boost.wav in Resources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
@ -132,6 +132,7 @@ class EntityManager {
|
|||||||
scene.addChild(spriteNode.unitcountLabel)
|
scene.addChild(spriteNode.unitcountLabel)
|
||||||
scene.addChild(spriteNode.fire)
|
scene.addChild(spriteNode.fire)
|
||||||
}
|
}
|
||||||
|
SoundManager.sharedInstance.playSoundEffect(pathToFile: "attack_base",fileExtension: "wav",volumeLevel: -3.0)
|
||||||
}
|
}
|
||||||
GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.capture.fifty.bases", increasePercentComplete: 2)
|
GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.capture.fifty.bases", increasePercentComplete: 2)
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,7 @@ class HUD: GKEntity {
|
|||||||
EntityManager.gameEMInstance.getOpponentBases(for: EntityManager.gameEMInstance.getTeam()).forEach({base in base.component(ofType: TeamComponent.self)?.unitcountLabel.text = "\(base.unitCount)"})
|
EntityManager.gameEMInstance.getOpponentBases(for: EntityManager.gameEMInstance.getTeam()).forEach({base in base.component(ofType: TeamComponent.self)?.unitcountLabel.text = "\(base.unitCount)"})
|
||||||
GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.skill.first.time", increasePercentComplete: 100)
|
GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.skill.first.time", increasePercentComplete: 100)
|
||||||
GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.skill.spy.ten", increasePercentComplete: 10)
|
GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.skill.spy.ten", increasePercentComplete: 10)
|
||||||
|
SoundManager.sharedInstance.playSoundEffect(pathToFile: "use_boost",fileExtension: "wav", volumeLevel: 0.0)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
defSkill = SingeClickButtonNode(
|
defSkill = SingeClickButtonNode(
|
||||||
@ -70,6 +71,7 @@ class HUD: GKEntity {
|
|||||||
DataService.sharedInstance.localRoundData.hasDefenceBoost = true
|
DataService.sharedInstance.localRoundData.hasDefenceBoost = true
|
||||||
GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.skill.first.time", increasePercentComplete: 100)
|
GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.skill.first.time", increasePercentComplete: 100)
|
||||||
GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.skill.def.ten", increasePercentComplete: 10)
|
GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.skill.def.ten", increasePercentComplete: 10)
|
||||||
|
SoundManager.sharedInstance.playSoundEffect(pathToFile: "use_boost",fileExtension: "wav",volumeLevel: 0.0)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
atkSkill = SingeClickButtonNode(
|
atkSkill = SingeClickButtonNode(
|
||||||
@ -81,6 +83,7 @@ class HUD: GKEntity {
|
|||||||
DataService.sharedInstance.localRoundData.hasAttackBoost = true
|
DataService.sharedInstance.localRoundData.hasAttackBoost = true
|
||||||
GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.skill.first.time", increasePercentComplete: 100)
|
GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.skill.first.time", increasePercentComplete: 100)
|
||||||
GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.skill.atk.ten", increasePercentComplete: 10)
|
GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.skill.atk.ten", increasePercentComplete: 10)
|
||||||
|
SoundManager.sharedInstance.playSoundEffect(pathToFile: "use_boost",fileExtension: "wav",volumeLevel: 0.0)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -186,5 +189,6 @@ class HUD: GKEntity {
|
|||||||
SKAction.scale(by: 0.5, duration: 1),
|
SKAction.scale(by: 0.5, duration: 1),
|
||||||
])
|
])
|
||||||
currentRoundLabel.run(newRoundAction)
|
currentRoundLabel.run(newRoundAction)
|
||||||
|
SoundManager.sharedInstance.playSoundEffect(pathToFile: "new_round", fileExtension: "wav", volumeLevel: 0.0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,12 +8,16 @@
|
|||||||
|
|
||||||
import SpriteKit
|
import SpriteKit
|
||||||
import AVFoundation
|
import AVFoundation
|
||||||
|
import os
|
||||||
|
|
||||||
class SoundManager {
|
class SoundManager {
|
||||||
public static var sharedInstance = SoundManager()
|
public static var sharedInstance = SoundManager()
|
||||||
|
let LOG = OSLog.init(subsystem: "SoundManager", category: "SoundManager")
|
||||||
|
|
||||||
var audioPlayer = AVAudioPlayer()
|
var audioPlayer = AVAudioPlayer()
|
||||||
|
var effectPlayer = AVAudioPlayer()
|
||||||
var backgroundMainMenuAudio: URL?
|
var backgroundMainMenuAudio: URL?
|
||||||
|
var soundEffect: URL?
|
||||||
var isMusicPlaying = false
|
var isMusicPlaying = false
|
||||||
var isMusicEnabled = true
|
var isMusicEnabled = true
|
||||||
|
|
||||||
@ -39,6 +43,17 @@ class SoundManager {
|
|||||||
UserDefaults.standard.set(true, forKey: "noMusic")
|
UserDefaults.standard.set(true, forKey: "noMusic")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func playSoundEffect(pathToFile: String, fileExtension: String, volumeLevel: Float){
|
||||||
|
soundEffect = Bundle.main.url(forResource: pathToFile, withExtension: fileExtension)
|
||||||
|
do {
|
||||||
|
effectPlayer = try AVAudioPlayer(contentsOf: soundEffect!)
|
||||||
|
} catch {
|
||||||
|
os_log("Could not load sound file %@", log: LOG, type: .error, pathToFile)
|
||||||
|
}
|
||||||
|
effectPlayer.volume += volumeLevel
|
||||||
|
effectPlayer.play()
|
||||||
|
}
|
||||||
|
|
||||||
func setVolume(_ volume: Float) {
|
func setVolume(_ volume: Float) {
|
||||||
audioPlayer.volume = volume
|
audioPlayer.volume = volume
|
||||||
}
|
}
|
||||||
|
BIN
GoldWars/GoldWars/attack_base.wav
Normal file
BIN
GoldWars/GoldWars/attack_base.wav
Normal file
Binary file not shown.
BIN
GoldWars/GoldWars/new_round.wav
Normal file
BIN
GoldWars/GoldWars/new_round.wav
Normal file
Binary file not shown.
BIN
GoldWars/GoldWars/use_boost.wav
Normal file
BIN
GoldWars/GoldWars/use_boost.wav
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user