add backgroundMusic for MenuScene with SoundManager for futher Sound-Management - music with commercial use
This commit is contained in:
parent
3f73a6f64d
commit
9c990cc897
@ -46,6 +46,8 @@
|
|||||||
AB1D75A0245DEC0500671525 /* MapFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB1D759F245DEC0500671525 /* MapFactory.swift */; };
|
AB1D75A0245DEC0500671525 /* MapFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB1D759F245DEC0500671525 /* MapFactory.swift */; };
|
||||||
ABA03DA0244BD54F00A66916 /* Base.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABA03D9F244BD54F00A66916 /* Base.swift */; };
|
ABA03DA0244BD54F00A66916 /* Base.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABA03D9F244BD54F00A66916 /* Base.swift */; };
|
||||||
AE151589245F18EF001D363E /* MatchmakingHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE151588245F18EF001D363E /* MatchmakingHelper.swift */; };
|
AE151589245F18EF001D363E /* MatchmakingHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE151588245F18EF001D363E /* MatchmakingHelper.swift */; };
|
||||||
|
C04783EE2468583F004961FB /* intro-music.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = C04783ED2468583F004961FB /* intro-music.mp3 */; };
|
||||||
|
C05FAED62468559D0006AF2E /* SoundManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = C05FAED52468559D0006AF2E /* SoundManager.swift */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
/* Begin PBXContainerItemProxy section */
|
||||||
@ -103,6 +105,8 @@
|
|||||||
AB1D759F245DEC0500671525 /* MapFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapFactory.swift; sourceTree = "<group>"; };
|
AB1D759F245DEC0500671525 /* MapFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapFactory.swift; sourceTree = "<group>"; };
|
||||||
ABA03D9F244BD54F00A66916 /* Base.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Base.swift; sourceTree = "<group>"; };
|
ABA03D9F244BD54F00A66916 /* Base.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Base.swift; sourceTree = "<group>"; };
|
||||||
AE151588245F18EF001D363E /* MatchmakingHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MatchmakingHelper.swift; sourceTree = "<group>"; };
|
AE151588245F18EF001D363E /* MatchmakingHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MatchmakingHelper.swift; sourceTree = "<group>"; };
|
||||||
|
C04783ED2468583F004961FB /* intro-music.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = "intro-music.mp3"; sourceTree = "<group>"; };
|
||||||
|
C05FAED52468559D0006AF2E /* SoundManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SoundManager.swift; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@ -146,6 +150,7 @@
|
|||||||
110360D1244B101A008610AF /* GoldWars */ = {
|
110360D1244B101A008610AF /* GoldWars */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
C04783ED2468583F004961FB /* intro-music.mp3 */,
|
||||||
9ECD3699245C91F7008DEEBD /* GoldWars.entitlements */,
|
9ECD3699245C91F7008DEEBD /* GoldWars.entitlements */,
|
||||||
9E11FF74245CD79100EED3BE /* Partikels */,
|
9E11FF74245CD79100EED3BE /* Partikels */,
|
||||||
116060F5245C5709004E5A36 /* Entities */,
|
116060F5245C5709004E5A36 /* Entities */,
|
||||||
@ -155,6 +160,7 @@
|
|||||||
9EC86BA4245C8A1E00796EF3 /* Scenes */,
|
9EC86BA4245C8A1E00796EF3 /* Scenes */,
|
||||||
9EC86BA3245C89F400796EF3 /* Storyboards */,
|
9EC86BA3245C89F400796EF3 /* Storyboards */,
|
||||||
110360D2244B101A008610AF /* AppDelegate.swift */,
|
110360D2244B101A008610AF /* AppDelegate.swift */,
|
||||||
|
C05FAED52468559D0006AF2E /* SoundManager.swift */,
|
||||||
110360DA244B101A008610AF /* GameViewController.swift */,
|
110360DA244B101A008610AF /* GameViewController.swift */,
|
||||||
110360DF244B101B008610AF /* Assets.xcassets */,
|
110360DF244B101B008610AF /* Assets.xcassets */,
|
||||||
110360E4244B101B008610AF /* Info.plist */,
|
110360E4244B101B008610AF /* Info.plist */,
|
||||||
@ -347,6 +353,7 @@
|
|||||||
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 */,
|
||||||
|
C04783EE2468583F004961FB /* intro-music.mp3 in Resources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@ -397,6 +404,7 @@
|
|||||||
110360D3244B101A008610AF /* AppDelegate.swift in Sources */,
|
110360D3244B101A008610AF /* AppDelegate.swift in Sources */,
|
||||||
9EC86B9F245C88A300796EF3 /* Modal.swift in Sources */,
|
9EC86B9F245C88A300796EF3 /* Modal.swift in Sources */,
|
||||||
9E78ACC2245CC9EE00526FF7 /* DefBoostSkillComponent.swift in Sources */,
|
9E78ACC2245CC9EE00526FF7 /* DefBoostSkillComponent.swift in Sources */,
|
||||||
|
C05FAED62468559D0006AF2E /* SoundManager.swift in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
@ -11,8 +11,10 @@ import SpriteKit
|
|||||||
class MenuScene: SKScene {
|
class MenuScene: SKScene {
|
||||||
|
|
||||||
var entityManager: EntityManager!
|
var entityManager: EntityManager!
|
||||||
|
var soundManager: SoundManager!
|
||||||
|
|
||||||
override func sceneDidLoad() {
|
override func sceneDidLoad() {
|
||||||
|
soundManager = SoundManager()
|
||||||
entityManager = EntityManager(scene: self)
|
entityManager = EntityManager(scene: self)
|
||||||
let midX = self.size.width / 2
|
let midX = self.size.width / 2
|
||||||
let midY = self.size.height / 2
|
let midY = self.size.height / 2
|
||||||
@ -35,6 +37,8 @@ class MenuScene: SKScene {
|
|||||||
//TODO: create Settings Scene
|
//TODO: create Settings Scene
|
||||||
}))
|
}))
|
||||||
entityManager.add(Background(size: self.size))
|
entityManager.add(Background(size: self.size))
|
||||||
|
|
||||||
|
soundManager.startMenuMusic()
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadScene(scene: SKScene) {
|
func loadScene(scene: SKScene) {
|
||||||
|
27
GoldWars/GoldWars/SoundManager.swift
Normal file
27
GoldWars/GoldWars/SoundManager.swift
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
//
|
||||||
|
// SoundManager.swift
|
||||||
|
// GoldWars
|
||||||
|
//
|
||||||
|
// Created by Tim Herbst on 10.05.20.
|
||||||
|
// Copyright © 2020 SP2. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SpriteKit
|
||||||
|
import AVFoundation
|
||||||
|
|
||||||
|
class SoundManager {
|
||||||
|
var audioPlayer = AVAudioPlayer()
|
||||||
|
var backgroundMainMenuAudio: URL?
|
||||||
|
|
||||||
|
func startMenuMusic() {
|
||||||
|
backgroundMainMenuAudio = Bundle.main.url(forResource: "intro-music", withExtension: "mp3")
|
||||||
|
do {
|
||||||
|
audioPlayer = try AVAudioPlayer(contentsOf: backgroundMainMenuAudio!)
|
||||||
|
} catch {
|
||||||
|
print("Datei nicht gefunden!")
|
||||||
|
}
|
||||||
|
audioPlayer.numberOfLoops = -1
|
||||||
|
audioPlayer.prepareToPlay()
|
||||||
|
audioPlayer.play()
|
||||||
|
}
|
||||||
|
}
|
BIN
GoldWars/GoldWars/intro-music.mp3
Normal file
BIN
GoldWars/GoldWars/intro-music.mp3
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user