private void Update() { if (this.terraincheck) { TerrainTextureHelper.GetTextureIndex(base.origin); } if (base.stateFlags.grounded) { bool flag = this.trait.timeLimited; bool flag1 = flag; if ((!flag || this.nextAllowTime <= Time.time) && (!base.masterControllable || !(base.masterControllable.idMain != base.idMain))) { bool flag2 = base.stateFlags.crouch; Vector3 vector3 = base.origin; FootstepEmitter footstepEmitter = this; footstepEmitter.movedAmount = footstepEmitter.movedAmount + Vector3.Distance(this.lastFootstepPos, vector3); this.lastFootstepPos = vector3; if (this.movedAmount >= this.trait.sqrStrideDist) { this.movedAmount = 0f; AudioClip item = null; if (footsteps.quality >= 2 || footsteps.quality == 1 && base.character.localControlled) { Collider belowObj = this.GetBelowObj(); if (belowObj) { SurfaceInfoObject surfaceInfoFor = SurfaceInfo.GetSurfaceInfoFor(belowObj, vector3); if (surfaceInfoFor) { item = (!this.trait.animal ? surfaceInfoFor.GetFootstepBiped(this.lastPlayed) : surfaceInfoFor.GetFootstepAnimal()); this.lastPlayed = item; } } } if (!item) { item = this.trait.defaultFootsteps[UnityEngine.Random.Range(0, this.trait.defaultFootsteps.Length)]; if (!item) { return; } } float single = this.trait.minAudioDist; float single1 = this.trait.maxAudioDist; if (!flag2) { item.Play(vector3, 0.65f, UnityEngine.Random.Range(0.95f, 1.05f), single, single1, 30); } else { item.Play(vector3, 0.2f, UnityEngine.Random.Range(0.95f, 1.05f), single * 0.333f, single1 * 0.333f, 30); } if (flag1) { this.nextAllowTime = Time.time + this.trait.minInterval; } } return; } } }
private void Update() { bool flag; if (this.terraincheck) { int textureIndex = TerrainTextureHelper.GetTextureIndex(base.origin); } if ((base.stateFlags.grounded && (!(flag = this.trait.timeLimited) || (this.nextAllowTime <= Time.time))) && ((base.masterControllable == null) || (base.masterControllable.idMain == base.idMain))) { bool crouch = base.stateFlags.crouch; Vector3 origin = base.origin; this.movedAmount += Vector3.Distance(this.lastFootstepPos, origin); this.lastFootstepPos = origin; if (this.movedAmount >= this.trait.sqrStrideDist) { this.movedAmount = 0f; AudioClip clip = null; if ((footsteps.quality >= 2) || ((footsteps.quality == 1) && base.character.localControlled)) { Collider belowObj = this.GetBelowObj(); if (belowObj != null) { SurfaceInfoObject surfaceInfoFor = SurfaceInfo.GetSurfaceInfoFor(belowObj, origin); if (surfaceInfoFor != null) { clip = !this.trait.animal ? surfaceInfoFor.GetFootstepBiped(this.lastPlayed) : surfaceInfoFor.GetFootstepAnimal(); this.lastPlayed = clip; } } } if (clip == null) { clip = this.trait.defaultFootsteps[UnityEngine.Random.Range(0, this.trait.defaultFootsteps.Length)]; if (clip == null) { return; } } float minAudioDist = this.trait.minAudioDist; float maxAudioDist = this.trait.maxAudioDist; if (crouch) { clip.Play(origin, 0.2f, UnityEngine.Random.Range((float)0.95f, (float)1.05f), minAudioDist * 0.333f, maxAudioDist * 0.333f, 30); } else { clip.Play(origin, 0.65f, UnityEngine.Random.Range((float)0.95f, (float)1.05f), minAudioDist, maxAudioDist, 30); } if (flag) { this.nextAllowTime = Time.time + this.trait.minInterval; } } } }