Add music throughout. Start work on the prediction side pannels
This commit is contained in:
@@ -5,7 +5,14 @@ using Utils.Utils;
|
||||
|
||||
public class AudioManager : Singleton<AudioManager>
|
||||
{
|
||||
//aaaaa theres nicer syntax for this i think
|
||||
protected override bool dontDestroyOnLoad()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private AudioSource audioSource;
|
||||
private AudioSource musicAudioSource;
|
||||
|
||||
[SerializeField]
|
||||
private List<GameEntry<AudioClip>> clips = new List<GameEntry<AudioClip>>();
|
||||
@@ -19,6 +26,13 @@ public class AudioManager : Singleton<AudioManager>
|
||||
{
|
||||
audioSource = GetComponent<AudioSource>();
|
||||
audioSource.pitch = 1;
|
||||
|
||||
musicAudioSource = transform.Find("Music").GetComponent<AudioSource>();
|
||||
musicAudioSource.loop = true;
|
||||
if (!musicAudioSource.isPlaying)
|
||||
{
|
||||
musicAudioSource.Play();
|
||||
}
|
||||
}
|
||||
|
||||
public void PlaySound(string type)
|
||||
@@ -35,4 +49,20 @@ public class AudioManager : Singleton<AudioManager>
|
||||
audioSource.PlayOneShot(speech[index], 1.5f);
|
||||
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
transform.position = Camera.main.transform.position;
|
||||
}
|
||||
|
||||
public void PlayMusic()
|
||||
{
|
||||
if (musicAudioSource.isPlaying) return;
|
||||
musicAudioSource.Play();
|
||||
}
|
||||
|
||||
public void StopMusic()
|
||||
{
|
||||
musicAudioSource.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user