public override void PlaySound(AnimEventManager.EventPlayerData behaviour) { Vector3 position = behaviour.GetComponent <Transform>().GetPosition(); Worker component = behaviour.GetComponent <Worker>(); if ((UnityEngine.Object)component == (UnityEngine.Object)null) { SoundEvent.PlayOneShot(GlobalAssets.GetSound("Building_Dmg_Metal", false), position); } else { Workable workable = component.workable; if ((UnityEngine.Object)workable != (UnityEngine.Object)null) { Building component2 = workable.GetComponent <Building>(); if ((UnityEngine.Object)component2 != (UnityEngine.Object)null) { BuildingDef def = component2.Def; string name = StringFormatter.Combine(base.name, "_", def.AudioCategory); string sound = GlobalAssets.GetSound(name, false); if (sound == null) { name = "Building_Dmg_Metal"; sound = GlobalAssets.GetSound(name, false); } if (sound != null) { SoundEvent.PlayOneShot(sound, position); } } } } }
public override void PlaySound(AnimEventManager.EventPlayerData behaviour) { Vector3 position = behaviour.GetComponent <Transform>().GetPosition(); int cell = Grid.PosToCell(position); GameObject gameObject = null; BuildingDef buildingDef = null; if (Grid.IsValidCell(cell)) { gameObject = Grid.Objects[cell, 1]; if ((Object)gameObject != (Object)null && (Object)gameObject.GetComponent <Ladder>() != (Object)null) { Building component = gameObject.GetComponent <BuildingComplete>(); if ((Object)component != (Object)null) { buildingDef = component.Def; } } } if ((Object)buildingDef != (Object)null) { string name = (!(buildingDef.PrefabID == "LadderFast")) ? base.name : StringFormatter.Combine(base.name, "_Plastic"); string sound = GlobalAssets.GetSound(name, false); if (sound != null) { SoundEvent.PlayOneShot(sound, position); } } }
public override void OnPlay(AnimEventManager.EventPlayerData behaviour) { string sound = GlobalAssets.GetSound(StringFormatter.Combine(base.name, "_", GetChewSound(behaviour)), false); if (SoundEvent.ShouldPlaySound(behaviour.controller, sound, base.looping, isDynamic)) { Vector3 position = behaviour.GetComponent <Transform>().GetPosition(); EventInstance instance = SoundEvent.BeginOneShot(sound, position); if (behaviour.controller.gameObject.GetDef <BabyMonitor.Def>() != null) { instance.setParameterValue("isBaby", 1f); } SoundEvent.EndOneShot(instance); } }
public override void PlaySound(AnimEventManager.EventPlayerData behaviour) { string sound = base.sound; CreatureBrain component = behaviour.GetComponent <CreatureBrain>(); if ((Object)component != (Object)null && !string.IsNullOrEmpty(component.symbolPrefix)) { string sound2 = GlobalAssets.GetSound(StringFormatter.Combine(component.symbolPrefix, base.name), false); if (!string.IsNullOrEmpty(sound2)) { sound = sound2; } } PlaySound(behaviour, sound); }
private void PlayBuildingDamageSound(BuildingDef def, Vector3 pos) { if ((Object)def != (Object)null) { string name = StringFormatter.Combine("MeteorDamage_Building_", def.AudioCategory); string sound = GlobalAssets.GetSound(name, false); if (sound == null) { name = "MeteorDamage_Building_Metal"; sound = GlobalAssets.GetSound(name, false); } if (sound != null && (bool)CameraController.Instance && CameraController.Instance.IsAudibleSound(pos, sound)) { KFMOD.PlayOneShot(sound, CameraController.Instance.GetVerticallyScaledPosition(pos)); } } }
public override void PlaySound(AnimEventManager.EventPlayerData behaviour) { Vector3 pos = behaviour.GetComponent <Transform>().GetPosition(); KBatchedAnimController component = behaviour.GetComponent <KBatchedAnimController>(); if ((Object)component != (Object)null) { pos = component.GetPivotSymbolPosition(); } int num = Grid.PosToCell(pos); int cell = Grid.CellBelow(num); string audioCategory = GetAudioCategory(cell); string name = StringFormatter.Combine(audioCategory, "_", base.name); string sound = GlobalAssets.GetSound(name, true); if (sound == null) { name = StringFormatter.Combine("Rock_", base.name); sound = GlobalAssets.GetSound(name, true); if (sound == null) { name = base.name; sound = GlobalAssets.GetSound(name, true); } } if (!SoundEvent.IsLowPrioritySound(sound)) { pos = SoundEvent.GetCameraScaledPosition(pos); if (Grid.Element != null) { bool isLiquid = Grid.Element[num].IsLiquid; float num2 = 0f; if (isLiquid) { num2 = SoundUtil.GetLiquidDepth(num); string sound2 = GlobalAssets.GetSound("Liquid_footstep", true); if (sound2 != null) { FMOD.Studio.EventInstance instance = SoundEvent.BeginOneShot(sound2, pos); if (num2 > 0f) { instance.setParameterValue("liquidDepth", num2); } SoundEvent.EndOneShot(instance); } } if (sound != null) { FMOD.Studio.EventInstance instance2 = SoundEvent.BeginOneShot(sound, pos); if (instance2.isValid()) { if (num2 > 0f) { instance2.setParameterValue("liquidDepth", num2); } if (behaviour.currentAnimFile != null && behaviour.currentAnimFile.Contains("anim_loco_walk")) { instance2.setVolume(IDLE_WALKING_VOLUME_REDUCTION); } SoundEvent.EndOneShot(instance2); } } } } }