private void PlayExplosionSound(SoundDef explosionSound) { if ((!Prefs.DevMode) ? (!explosionSound.NullOrUndefined()) : (explosionSound != null)) { explosionSound.PlayOneShot(new TargetInfo(base.Position, base.Map)); } else { damType.soundExplosion.PlayOneShot(new TargetInfo(base.Position, base.Map)); } }
public static void PlayNearestLifestageSound(Pawn pawn, Func <LifeStageAge, SoundDef> getter, float volumeFactor = 1f) { SoundDef soundDef = default(SoundDef); float pitchFactor = default(float); float num = default(float); LifeStageUtility.GetNearestLifestageSound(pawn, getter, out soundDef, out pitchFactor, out num); if (soundDef != null && pawn.SpawnedOrAnyParentSpawned) { SoundInfo info = SoundInfo.InMap(new TargetInfo(pawn.PositionHeld, pawn.MapHeld, false), MaintenanceType.None); info.pitchFactor = pitchFactor; info.volumeFactor = num * volumeFactor; soundDef.PlayOneShot(info); } }
private static void PlaySound() { List <DebugMenuOption> list = new List <DebugMenuOption>(); foreach (SoundDef item in DefDatabase <SoundDef> .AllDefs.Where((SoundDef s) => !s.sustain)) { SoundDef localSd = item; list.Add(new DebugMenuOption(localSd.defName, DebugMenuOptionMode.Action, delegate { if (localSd.subSounds.Any((SubSoundDef sub) => sub.onCamera)) { localSd.PlayOneShotOnCamera(); } else { localSd.PlayOneShot(SoundInfo.InMap(new TargetInfo(Find.CameraDriver.MapPosition, Find.CurrentMap))); } })); } Find.WindowStack.Add(new Dialog_DebugOptionListLister(list)); }
private void PlayExplosionSound(SoundDef explosionSound) { bool flag; if (Prefs.DevMode) { flag = (explosionSound != null); } else { flag = !explosionSound.NullOrUndefined(); } if (flag) { explosionSound.PlayOneShot(new TargetInfo(base.Position, base.Map, false)); } else { this.damType.soundExplosion.PlayOneShot(new TargetInfo(base.Position, base.Map, false)); } }
public override void Spawn(Map map, Vector3 position) { sound.PlayOneShot(new TargetInfo(position.ToIntVec3(), map, false)); }