TO SQUASH: Added player gun and pause.
This commit is contained in:
@@ -14,6 +14,8 @@ public class MusicManager : MonoBehaviour
|
||||
|
||||
private Queue<AudioClip> clipsQueue;
|
||||
|
||||
private bool isPaused = false;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
@@ -28,7 +30,7 @@ public class MusicManager : MonoBehaviour
|
||||
// Update is called once per frame
|
||||
void FixedUpdate()
|
||||
{
|
||||
if (audioSource.isPlaying == false)
|
||||
if (audioSource.isPlaying == false && !isPaused)
|
||||
{
|
||||
audioSource.clip = clipsQueue.Dequeue();
|
||||
audioSource.Play();
|
||||
@@ -48,4 +50,16 @@ public class MusicManager : MonoBehaviour
|
||||
clipsQueue.Enqueue(loop);
|
||||
clipsQueue.Enqueue(outro);
|
||||
}
|
||||
|
||||
public void pauseMusic()
|
||||
{
|
||||
audioSource.Pause();
|
||||
isPaused = true;
|
||||
}
|
||||
|
||||
public void resumeMusic()
|
||||
{
|
||||
audioSource.UnPause();
|
||||
isPaused = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user