public void PlaySound(S_Sound sound) { // Debug.Log("Playing sound: " + sound.name); if (!sound.backgroundMusic) { StopCurrent(mySource); // Debug.Log("Playing sound"); mySource.clip = sound.clip; mySource.panStereo = sound.panning; mySource.volume = sound.volume; mySource.loop = sound.looping; mySource.PlayOneShot(sound.clip); } else { StopCurrent(myBGMusicSource); myBGMusicSource.clip = sound.clip; myBGMusicSource.panStereo = sound.panning; myBGMusicSource.volume = sound.volume; myBGMusicSource.loop = sound.looping; myBGMusicSource.Play(); } }
public void PlaySound(S_Sound sound) { if (!audioToggle.Value) { Value.MusicOff(); return; } else { Value.MusicOn(); } Value.PlaySound(sound); }