Add music throughout. Start work on the prediction side pannels

This commit is contained in:
WillJeynes
2026-08-27 18:43:49 +01:00
parent 2ccfb29399
commit abe7a12244
12 changed files with 2194 additions and 136 deletions
+30
View File
@@ -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();
}
}