protected override void OnDragTool(int cell, int distFromOrigin) { if (path.Count == 0) { return; } PathNode pathNode = path[path.Count - 1]; if (pathNode.cell == cell) { return; } placeSound = GlobalAssets.GetSound("Place_building_" + def.AudioSize, false); Vector3 pos = Grid.CellToPos(cell); EventInstance instance = SoundEvent.BeginOneShot(placeSound, pos); if (path.Count > 1) { int num = cell; PathNode pathNode2 = path[path.Count - 2]; if (num == pathNode2.cell) { if ((Object)previousCellConnection != (Object)null) { previousCellConnection.ConnectedEvent(previousCell); KMonoBehaviour.PlaySound(GlobalAssets.GetSound("OutletDisconnected", false)); previousCellConnection = null; } previousCell = cell; CheckForConnection(cell, def.PrefabID, string.Empty, ref previousCellConnection, false); PathNode pathNode3 = path[path.Count - 1]; Object.Destroy(pathNode3.visualizer); PathNode pathNode4 = path[path.Count - 1]; TileVisualizer.RefreshCell(pathNode4.cell, def.TileLayer, def.ReplacementLayer); path.RemoveAt(path.Count - 1); buildingCount = ((buildingCount != 1) ? (buildingCount - 1) : (buildingCount = 14)); instance.setParameterValue("tileCount", (float)buildingCount); SoundEvent.EndOneShot(instance); goto IL_029c; } } if (!path.Exists((PathNode n) => n.cell == cell)) { bool valid = CheckValidPathPiece(cell); path.Add(new PathNode { cell = cell, visualizer = null, valid = valid }); CheckForConnection(cell, def.PrefabID, "OutletConnected", ref previousCellConnection, true); buildingCount = buildingCount % 14 + 1; instance.setParameterValue("tileCount", (float)buildingCount); SoundEvent.EndOneShot(instance); } goto IL_029c; IL_029c: visualizer.SetActive(path.Count < 2); ResourceRemainingDisplayScreen.instance.SetNumberOfPendingConstructions(path.Count); }
public override void OnLeftClickDown(Vector3 cursor_pos) { if (!((Object)visualizer == (Object)null)) { path.Clear(); int cell = Grid.PosToCell(cursor_pos); if (Grid.IsValidCell(cell) && Grid.IsVisible(cell)) { bool valid = CheckValidPathPiece(cell); path.Add(new PathNode { cell = cell, visualizer = null, valid = valid }); CheckForConnection(cell, def.PrefabID, "OutletConnected", ref previousCellConnection, true); } visUpdater = StartCoroutine(VisUpdater()); visualizer.GetComponent <KBatchedAnimController>().StopAndClear(); ResourceRemainingDisplayScreen.instance.SetNumberOfPendingConstructions(1); placeSound = GlobalAssets.GetSound("Place_building_" + def.AudioSize, false); if (placeSound != null) { buildingCount = buildingCount % 14 + 1; Vector3 pos = Grid.CellToPos(cell); EventInstance instance = SoundEvent.BeginOneShot(placeSound, pos); if (def.AudioSize == "small") { instance.setParameterValue("tileCount", (float)buildingCount); } SoundEvent.EndOneShot(instance); } base.OnLeftClickDown(cursor_pos); } }
public override void OnPlay(AnimEventManager.EventPlayerData behaviour) { if (!string.IsNullOrEmpty(base.sound) && SoundEvent.ShouldPlaySound(behaviour.controller, base.sound, base.looping, isDynamic)) { int num = -1; GameObject gameObject = behaviour.controller.gameObject; if (counterModulus >= -1) { HandleVector <int> .Handle h = GameComps.WhiteBoards.GetHandle(gameObject); if (!h.IsValid()) { h = GameComps.WhiteBoards.Add(gameObject); } num = (GameComps.WhiteBoards.HasValue(h, base.soundHash) ? ((int)GameComps.WhiteBoards.GetValue(h, base.soundHash)) : 0); int num2 = (counterModulus != -1) ? ((num + 1) % counterModulus) : 0; GameComps.WhiteBoards.SetValue(h, base.soundHash, num2); } Vector3 position = behaviour.GetComponent <Transform>().GetPosition(); EventInstance instance = SoundEvent.BeginOneShot(base.sound, position); if (instance.isValid()) { if (num >= 0) { instance.setParameterValue("eventCount", (float)num); } SoundEvent.EndOneShot(instance); } } }
private void TriggerAudio() { if (!SpeedControlScreen.Instance.IsPaused) { CameraController instance = CameraController.Instance; int num = 0; List <AudioInfo> list = new List <AudioInfo>(); for (int i = 0; i < this.audioInfo.Count; i++) { CameraController cameraController = instance; AudioInfo audioInfo = this.audioInfo[i]; if (cameraController.IsVisiblePos(audioInfo.position)) { list.Add(this.audioInfo[i]); num++; } } for (int j = 0; j < list.Count; j++) { AudioInfo audioInfo2 = list[j]; if (audioInfo2.distance != float.PositiveInfinity) { EventInstance instance2 = SoundEvent.BeginOneShot(overlaySound, audioInfo2.position); instance2.setParameterValue("blobCount", (float)audioInfo2.blobCount); instance2.setParameterValue("networkCount", (float)num); SoundEvent.EndOneShot(instance2); } } } }
public override void PlaySound(AnimEventManager.EventPlayerData behaviour) { Vector3 position = behaviour.GetComponent <Transform>().GetPosition(); int cell = Grid.PosToCell(position); int cell2 = Grid.CellBelow(cell); float value = (float)GetAudioCategory(cell2); EventInstance instance = SoundEvent.BeginOneShot(base.sound, position); instance.setParameterValue("material_ID", value); SoundEvent.EndOneShot(instance); }
public override void OnPlay(AnimEventManager.EventPlayerData behaviour) { if (!string.IsNullOrEmpty(base.sound) && SoundEvent.ShouldPlaySound(behaviour.controller, base.sound, base.looping, isDynamic)) { int num = -1; GameObject gameObject = behaviour.controller.gameObject; if (counterModulus >= -1) { HandleVector <int> .Handle h = GameComps.WhiteBoards.GetHandle(gameObject); if (!h.IsValid()) { h = GameComps.WhiteBoards.Add(gameObject); } num = (GameComps.WhiteBoards.HasValue(h, base.soundHash) ? ((int)GameComps.WhiteBoards.GetValue(h, base.soundHash)) : 0); int num2 = (counterModulus != -1) ? ((num + 1) % counterModulus) : 0; GameComps.WhiteBoards.SetValue(h, base.soundHash, num2); } Vector3 position = behaviour.GetComponent <Transform>().GetPosition(); string sound = GlobalAssets.GetSound("Hammer_sculpture", false); Worker component = behaviour.GetComponent <Worker>(); if ((UnityEngine.Object)component != (UnityEngine.Object)null) { 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; switch (def.name) { case "MetalSculpture": sound = GlobalAssets.GetSound("Hammer_sculpture_metal", false); break; case "MarbleSculpture": sound = GlobalAssets.GetSound("Hammer_sculpture_marble", false); break; } } } } EventInstance instance = SoundEvent.BeginOneShot(sound, position); if (instance.isValid()) { if (num >= 0) { instance.setParameterValue("eventCount", (float)num); } SoundEvent.EndOneShot(instance); } } }
public void Select(KSelectable new_selected, bool skipSound = false) { if (!((Object)new_selected == (Object)previousSelection)) { previousSelection = new_selected; if ((Object)selected != (Object)null) { selected.Unselect(); } GameObject gameObject = null; if ((Object)new_selected != (Object)null) { SelectToolHoverTextCard component = GetComponent <SelectToolHoverTextCard>(); if ((Object)component != (Object)null) { int currentSelectedSelectableIndex = component.currentSelectedSelectableIndex; int recentNumberOfDisplayedSelectables = component.recentNumberOfDisplayedSelectables; if (recentNumberOfDisplayedSelectables != 0) { currentSelectedSelectableIndex = (currentSelectedSelectableIndex + 1) % recentNumberOfDisplayedSelectables; if (!skipSound) { if (recentNumberOfDisplayedSelectables == 1) { KFMOD.PlayOneShot(GlobalAssets.GetSound("Select_empty", false)); } else { EventInstance instance = KFMOD.BeginOneShot(GlobalAssets.GetSound("Select_full", false), Vector3.zero); instance.setParameterValue("selection", (float)currentSelectedSelectableIndex); SoundEvent.EndOneShot(instance); } playedSoundThisFrame = true; } } } if ((Object)new_selected == (Object)hover) { ClearHover(); } new_selected.Select(); gameObject = new_selected.gameObject; selectMarker.SetTargetTransform(gameObject.transform); selectMarker.gameObject.SetActive(!new_selected.DisableSelectMarker); } else if ((Object)selectMarker != (Object)null) { selectMarker.gameObject.SetActive(false); } selected = new_selected; Game.Instance.Trigger(-1503271301, gameObject); } }
public void PlaySoundEffect(string sound, float vol) { if (soundEvents == null) { return; } SoundEvent.EndOneShot( SoundEvent.BeginOneShot( soundEvents[sound], transform.position, vol, SoundEvent.ObjectIsSelectedAndVisible(gameObject))); }
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) { Vector3 position = behaviour.GetComponent <Transform>().GetPosition(); Workable workable = behaviour.GetComponent <Worker>().workable; if ((UnityEngine.Object)workable != (UnityEngine.Object)null) { Toggleable component = workable.GetComponent <Toggleable>(); if ((UnityEngine.Object)component != (UnityEngine.Object)null) { IToggleHandler toggleHandlerForWorker = component.GetToggleHandlerForWorker(behaviour.GetComponent <Worker>()); float value = 1f; if (toggleHandlerForWorker != null && toggleHandlerForWorker.IsHandlerOn()) { value = 0f; } EventInstance instance = SoundEvent.BeginOneShot(base.sound, position); instance.setParameterValue("State", value); SoundEvent.EndOneShot(instance); } } }
private IEnumerator ConnectedDelay(float delay, int connectionCount, int cell, string soundName) { float startTime = Time.realtimeSinceStartup; float currentTime = startTime; if (currentTime < startTime + delay) { float num = currentTime + Time.unscaledDeltaTime; yield return((object)new WaitForEndOfFrame()); /*Error: Unable to find new state assignment for yield return*/; } ConnectedEvent(cell); string connectedReleaseSound = GlobalAssets.GetSound(soundName, false); if (connectedReleaseSound != null) { Vector3 position = base.transform.GetPosition(); EventInstance instance = SoundEvent.BeginOneShot(connectedReleaseSound, position); instance.setParameterValue("connectedCount", (float)connectionCount); SoundEvent.EndOneShot(instance); } }
public void PlayNewBuildingSounds() { if (KTime.Instance.UnscaledGameTime - initTime > 1.5f) { if (Instance.timeSinceNotificationPing >= 8f) { string sound = GlobalAssets.GetSound("NewBuildable_Embellishment", false); if (sound != null) { EventInstance instance = SoundEvent.BeginOneShot(sound, SoundListenerController.Instance.transform.GetPosition()); SoundEvent.EndOneShot(instance); } } string sound2 = GlobalAssets.GetSound("NewBuildable", false); if (sound2 != null) { EventInstance instance2 = SoundEvent.BeginOneShot(sound2, SoundListenerController.Instance.transform.GetPosition()); instance2.setParameterValue("playCount", (float)Instance.notificationPingCount); SoundEvent.EndOneShot(instance2); } } timeSinceNotificationPing = 0f; notificationPingCount++; }
public override void OnMouseMove(Vector3 cursorPos) { if (dragging) { if (Input.GetKey((KeyCode)Global.Instance.GetInputManager().GetDefaultController().GetInputForAction(Action.DragStraight))) { Vector3 vector = cursorPos - downPos; if ((canChangeDragAxis || dragAxis == DragAxis.Invalid) && vector.sqrMagnitude > 0.707f) { if (Mathf.Abs(vector.x) < Mathf.Abs(vector.y)) { dragAxis = DragAxis.Vertical; } else { dragAxis = DragAxis.Horizontal; } } } else { dragAxis = DragAxis.Invalid; } switch (dragAxis) { case DragAxis.Horizontal: cursorPos.y = downPos.y; break; case DragAxis.Vertical: cursorPos.x = downPos.x; break; } } base.OnMouseMove(cursorPos); if (dragging) { switch (GetMode()) { case Mode.Brush: AddDragPoints(cursorPos, previousCursorPos); if (areaVisualizerText != Guid.Empty) { int dragLength = GetDragLength(); GameObject worldText2 = NameDisplayScreen.Instance.GetWorldText(areaVisualizerText); LocText component2 = worldText2.GetComponent <LocText>(); component2.text = string.Format(UI.TOOLS.TOOL_LENGTH_FMT, dragLength); Vector3 a = Grid.CellToPos(Grid.PosToCell(cursorPos)); a += new Vector3(0f, 1f, 0f); component2.transform.SetPosition(a); } break; case Mode.Box: { Vector2 input = Vector3.Max(downPos, cursorPos); Vector2 input2 = Vector3.Min(downPos, cursorPos); input = GetRegularizedPos(input, false); input2 = GetRegularizedPos(input2, true); Vector2 vector2 = input - input2; Vector2 vector3 = (input + input2) * 0.5f; areaVisualizer.transform.SetPosition(new Vector2(vector3.x, vector3.y)); int num = (int)(input.x - input2.x + (input.y - input2.y) - 1f); if (areaVisualizerSpriteRenderer.size != vector2) { string sound = GlobalAssets.GetSound(GetDragSound(), false); if (sound != null) { EventInstance instance = SoundEvent.BeginOneShot(sound, areaVisualizer.transform.GetPosition()); instance.setParameterValue("tileCount", (float)num); SoundEvent.EndOneShot(instance); } } areaVisualizerSpriteRenderer.size = vector2; if (areaVisualizerText != Guid.Empty) { Vector2I vector2I = new Vector2I(Mathf.RoundToInt(vector2.x), Mathf.RoundToInt(vector2.y)); GameObject worldText = NameDisplayScreen.Instance.GetWorldText(areaVisualizerText); LocText component = worldText.GetComponent <LocText>(); component.text = string.Format(UI.TOOLS.TOOL_AREA_FMT, vector2I.x, vector2I.y); Vector2 v = vector3; component.transform.SetPosition(v); } break; } } previousCursorPos = cursorPos; } }
private void AddToSim(int cell, int particleIdx, ref int num_particles) { bool flag = false; do { Element element = Grid.Element[cell]; Element.State state = element.state & Element.State.Solid; if (state == Element.State.Solid || (Grid.Properties[cell] & 2) != 0) { cell += Grid.WidthInCells; if (!Grid.IsValidCell(cell)) { return; } } else { flag = true; } }while (!flag); ParticleProperties particleProperties = this.particleProperties[particleIdx]; SimMessages.AddRemoveSubstance(cell, particleProperties.elementIdx, CellEventLogger.Instance.FallingWaterAddToSim, particleProperties.mass, particleProperties.temperature, particleProperties.diseaseIdx, particleProperties.diseaseCount, true, -1); RemoveParticle(particleIdx, ref num_particles); float time = GetTime(); float num = lastSpawnTime[cell]; if (time - num >= minSpawnDelay) { lastSpawnTime[cell] = time; Vector3 vector = Grid.CellToPosCCC(cell, Grid.SceneLayer.TileMain); if (CameraController.Instance.IsAudibleSound(vector)) { bool flag2 = true; if (splashSounds.TryGetValue(cell, out SoundInfo value)) { value.splashCount++; if (value.splashCount > splashCountLoopThreshold) { if (value.handle == HandleVector <int> .InvalidHandle) { value.handle = LoopingSoundManager.StartSound(liquid_splash_loop, vector, true, true); } LoopingSoundManager.Get().UpdateFirstParameter(value.handle, HASH_LIQUIDDEPTH, SoundUtil.GetLiquidDepth(cell)); LoopingSoundManager.Get().UpdateSecondParameter(value.handle, HASH_LIQUIDVOLUME, GetParticleVolume(particleProperties.mass)); flag2 = false; } } else { value = default(SoundInfo); value.handle = HandleVector <int> .InvalidHandle; } value.startTime = time; splashSounds[cell] = value; if (flag2) { EventInstance instance = SoundEvent.BeginOneShot(liquid_splash_initial, vector); instance.setParameterValue("liquidDepth", SoundUtil.GetLiquidDepth(cell)); instance.setParameterValue("liquidVolume", GetParticleVolume(particleProperties.mass)); SoundEvent.EndOneShot(instance); } } } }
private void TryBuild(int cell) { if (!((Object)visualizer == (Object)null) && (cell != lastDragCell || buildingOrientation != lastDragOrientation)) { int num = Grid.PosToCell(visualizer); if (num == cell || (!(bool)def.BuildingComplete.GetComponent <LogicPorts>() && !(bool)def.BuildingComplete.GetComponent <LogicGateBase>())) { lastDragCell = cell; lastDragOrientation = buildingOrientation; ClearTilePreview(); Vector3 vector = Grid.CellToPosCBC(cell, Grid.SceneLayer.Building); GameObject gameObject = null; if (DebugHandler.InstantBuildMode || (Game.Instance.SandboxModeActive && SandboxToolParameterMenu.instance.settings.InstantBuild)) { if (def.IsValidBuildLocation(visualizer, vector, buildingOrientation) && def.IsValidPlaceLocation(visualizer, vector, buildingOrientation, out string _)) { gameObject = def.Build(cell, buildingOrientation, null, selectedElements, 293.15f, false, GameClock.Instance.GetTime()); if ((Object)source != (Object)null) { source.DeleteObject(); } } } else { gameObject = def.TryPlace(visualizer, vector, buildingOrientation, selectedElements, 0); if ((Object)gameObject == (Object)null && def.ReplacementLayer != ObjectLayer.NumLayers) { GameObject replacementCandidate = def.GetReplacementCandidate(cell); if ((Object)replacementCandidate != (Object)null && !def.IsReplacementLayerOccupied(cell)) { BuildingComplete component = replacementCandidate.GetComponent <BuildingComplete>(); if ((Object)component != (Object)null && component.Def.Replaceable && def.CanReplace(replacementCandidate) && ((Object)component.Def != (Object)def || selectedElements[0] != replacementCandidate.GetComponent <PrimaryElement>().Element.tag)) { gameObject = def.TryReplaceTile(visualizer, vector, buildingOrientation, selectedElements, 0); Grid.Objects[cell, (int)def.ReplacementLayer] = gameObject; } } } if ((Object)gameObject != (Object)null) { Prioritizable component2 = gameObject.GetComponent <Prioritizable>(); if ((Object)component2 != (Object)null) { if ((Object)BuildMenu.Instance != (Object)null) { component2.SetMasterPriority(BuildMenu.Instance.GetBuildingPriority()); } if ((Object)PlanScreen.Instance != (Object)null) { component2.SetMasterPriority(PlanScreen.Instance.GetBuildingPriority()); } } if ((Object)source != (Object)null) { source.Trigger(2121280625, gameObject); } } } if ((Object)gameObject != (Object)null) { if (def.MaterialsAvailable(selectedElements) || DebugHandler.InstantBuildMode) { placeSound = GlobalAssets.GetSound("Place_Building_" + def.AudioSize, false); if (placeSound != null) { buildingCount = buildingCount % 14 + 1; EventInstance instance = SoundEvent.BeginOneShot(placeSound, vector); if (def.AudioSize == "small") { instance.setParameterValue("tileCount", (float)buildingCount); } SoundEvent.EndOneShot(instance); } } else { PopFXManager.Instance.SpawnFX(PopFXManager.Instance.sprite_Resource, UI.TOOLTIPS.NOMATERIAL, null, vector, 1.5f, false, false); } Rotatable component3 = gameObject.GetComponent <Rotatable>(); if ((Object)component3 != (Object)null) { component3.SetOrientation(buildingOrientation); } } } } }
private void GetBuildableStates(bool force_update) { if (Assets.BuildingDefs != null && Assets.BuildingDefs.Count != 0) { if (timeSinceNotificationPing < specialNotificationEmbellishDelay) { timeSinceNotificationPing += Time.unscaledDeltaTime; } if (timeSinceNotificationPing >= notificationPingExpire) { notificationPingCount = 0; } int num = 10; if (force_update) { num = Assets.BuildingDefs.Count; buildable_state_update_idx = 0; } ListPool <HashedString, PlanScreen> .PooledList pooledList = ListPool <HashedString, PlanScreen> .Allocate(); for (int i = 0; i < num; i++) { buildable_state_update_idx = (buildable_state_update_idx + 1) % Assets.BuildingDefs.Count; BuildingDef buildingDef = Assets.BuildingDefs[buildable_state_update_idx]; if (!buildingDef.Deprecated && tagCategoryMap.TryGetValue(buildingDef.Tag, out HashedString value)) { RequirementsState requirementsState = RequirementsState.Complete; if (!DebugHandler.InstantBuildMode && !Game.Instance.SandboxModeActive) { if (!Db.Get().TechItems.IsTechItemComplete(buildingDef.PrefabID)) { requirementsState = RequirementsState.Tech; } else if (!ProductInfoScreen.MaterialsMet(buildingDef.CraftRecipe)) { requirementsState = RequirementsState.Materials; } } if (!buildableDefs.ContainsKey(buildingDef)) { buildableDefs.Add(buildingDef, requirementsState); } else if (buildableDefs[buildingDef] != requirementsState) { buildableDefs[buildingDef] = requirementsState; if ((UnityEngine.Object)productInfoScreen.currentDef == (UnityEngine.Object)buildingDef) { ignoreToolChangeMessages++; productInfoScreen.ClearProduct(false); productInfoScreen.Show(true); productInfoScreen.ConfigureScreen(buildingDef); ignoreToolChangeMessages--; } if (requirementsState == RequirementsState.Complete) { foreach (ToggleInfo item in toggleInfo) { HashedString x = (HashedString)item.userData; if (x == value) { string text = "NotificationPing"; Animator component = item.toggle.GetComponent <Animator>(); if (!component.GetCurrentAnimatorStateInfo(0).IsTag(text) && !pooledList.Contains(value)) { pooledList.Add(value); item.toggle.gameObject.GetComponent <Animator>().Play(text); if (KTime.Instance.UnscaledGameTime - initTime > 1.5f) { if (timeSinceNotificationPing >= specialNotificationEmbellishDelay) { string sound = GlobalAssets.GetSound("NewBuildable_Embellishment", false); if (sound != null) { EventInstance instance = SoundEvent.BeginOneShot(sound, SoundListenerController.Instance.transform.GetPosition()); SoundEvent.EndOneShot(instance); } } string sound2 = GlobalAssets.GetSound("NewBuildable", false); if (sound2 != null) { EventInstance instance2 = SoundEvent.BeginOneShot(sound2, SoundListenerController.Instance.transform.GetPosition()); instance2.setParameterValue("playCount", (float)notificationPingCount); SoundEvent.EndOneShot(instance2); } } timeSinceNotificationPing = 0f; notificationPingCount++; } } } } } } } pooledList.Recycle(); } }
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); } } } } }