Implemented as much audio as I could given the drafts/snippets of audio I've been given by Andrew
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class MusicScript : MonoBehaviour
|
||||
{
|
||||
private AudioSource audioSource;
|
||||
private void Awake()
|
||||
{
|
||||
DontDestroyOnLoad(transform.gameObject);
|
||||
audioSource = GetComponent<AudioSource>();
|
||||
}
|
||||
|
||||
public void PlayMusic()
|
||||
{
|
||||
if (audioSource.isPlaying) return;
|
||||
audioSource.Play();
|
||||
}
|
||||
|
||||
public void StopMusic()
|
||||
{
|
||||
audioSource.Stop();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user