public void DestroyAllSound(SoundID soundID) { List <Sound> sounds = _playingSoundList.Where(s => s._id.Equals(soundID.ToString())).ToList(); for (int i = sounds.Count - 1; i >= 0; i--) { sounds[i].Finish(false); } sounds.Clear(); }
static void VirtualMicrophone_PlaySound(On.VirtualMicrophone.orig_PlaySound_SoundID_PositionedSoundEmitter_bool_float_float_bool orig, VirtualMicrophone self, SoundID soundID, PositionedSoundEmitter controller, bool loop, float vol, float pitch, bool randomStartPosition) { if (NewSounds.SoundNames.Contains(soundID.ToString())) { SoundLoader.SoundData soundData = GetSlugcatSingSound(soundID); self.soundObjects.Add(new VirtualMicrophone.ObjectSound(self, soundData, loop, controller, vol, pitch, randomStartPosition)); } else { orig(self, soundID, controller, loop, vol, pitch, randomStartPosition); } }
public bool PlaySound(string soundName, SoundType type = SoundType.Replace, float delay = 0f) { for (int i = 0; i < (int)SoundID.Count; i++) { SoundID soundID = (SoundID)i; if (soundID.ToString() == soundName) { return(PlaySound(soundID, type, delay)); } } return(false); }