1
Fork 0
mirror of https://github.com/Steffo99/gravity-fusion.git synced 2024-11-22 16:24:20 +00:00
gravity-fusion/Assets/Components/MusicManager.cs

40 lines
838 B
C#
Raw Normal View History

2019-10-05 13:59:17 +00:00
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<MusicLayer> layers;
void Start()
{
List<AudioSource> audioSources = new List<AudioSource>();
GetComponentsInChildren<AudioSource>(true, audioSources);
foreach(AudioSource audioSource in audioSources) {
MusicLayer layer = new MusicLayer(audioSource);
layer.Volume = 0;
}
}
}