void PlayGeneralSound(GeneralSounds s) { if (!soundsEnabled) { return; } AudioSource source = FreeSource(sources); if (source != null) { switch (s) { case GeneralSounds.click: source.clip = click; break; case GeneralSounds.clueKO: source.clip = clue_button_ko; break; case GeneralSounds.clueOK: source.clip = clue_button_ok; break; case GeneralSounds.popup: source.clip = popup; break; case GeneralSounds.static_obstacle: source.clip = staticObstacle; break; case GeneralSounds.target_bad: source.clip = targetBad; break; case GeneralSounds.target_good: source.clip = targetGood; break; case GeneralSounds.target_normal: source.clip = targetNormal; break; case GeneralSounds.obst_Passed: source.clip = obstPassed; break; } SoundsManager.Instance.PlaySource(source); } }
void Awake() { instance = this; originalVolume = GetComponent <AudioSource>().volume; GetComponent <AudioSource>().volume = 0f; }