diff --git a/Assets/Components/MusicManager.cs b/Assets/Components/MusicManager.cs new file mode 100644 index 0000000..9aebfd0 --- /dev/null +++ b/Assets/Components/MusicManager.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + + +[Serializable] +public class MusicLayer { + public AudioSource audioSource; + + public MusicLayer(AudioSource audioSource) { + this.audioSource = audioSource; + } + + public float Volume { + get { + return audioSource.volume; + } + set { + audioSource.volume = value; + } + } +} + + +public class MusicManager : MonoBehaviour +{ + public List layers; + + void Start() + { + List audioSources = new List(); + GetComponentsInChildren(true, audioSources); + foreach(AudioSource audioSource in audioSources) { + MusicLayer layer = new MusicLayer(audioSource); + layer.Volume = 0; + } + } +} diff --git a/Assets/Components/MusicManager.cs.meta b/Assets/Components/MusicManager.cs.meta new file mode 100644 index 0000000..4c96543 --- /dev/null +++ b/Assets/Components/MusicManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c5d6ca16f02f68b44bdb6d018c9eb490 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: