public void Stop(Sounds.SOUND sound) { Sound soundToStop = getSound(sound); if (soundToStop == null) { return; } soundToStop.Stop(); }
public void Play(Sounds.SOUND sound) { Sound soundToPlay = getSound(sound); if (soundToPlay == null) { return; } soundToPlay.Play(); }
public Sound createSound(Sounds.SOUND sound) { Sound soundToClone = sounds.Find(soundItem => soundItem.name == sound); Sound newSound = new Sound(); newSound.volume = soundToClone.volume; newSound.pitch = soundToClone.pitch; newSound.name = soundToClone.name; newSound.loop = soundToClone.loop; newSound.audioClip = soundToClone.audioClip; newSound.playOnAwake = soundToClone.playOnAwake; newSound.setAudioSource(gameObject.AddComponent <AudioSource>()); allSounds.Add(newSound); if (isAudioOn) { newSound.mute(); } return(newSound); }
public Sound getSound(Sounds.SOUND sound) { return(sounds.Find(soundItem => soundItem.name == sound)); }