// Use the singleton pattern to manage playing audio for powerups. // This allows us to keep track of whether audio is playing, and stop the existing audio if it is public static PowerupSoundManager getInstance() { if (instance == null) { instance = new PowerupSoundManager(); aSource = GameObject.Find("AudioManagement").GetComponent <AudioManagement>(); } return(instance); }
void Start() { soundManager = PowerupSoundManager.getInstance(); StopAudio = soundManager.StopAudio; }