using System; using UnityEngine; // Token: 0x020000F5 RID: 245 [RequireComponent(typeof(AudioSource))] public class FlockChildSound : MonoBehaviour { // Token: 0x0600157D RID: 5501 RVA: 0x00199CB8 File Offset: 0x00197EB8 public void Start() { this._flockChild = base.GetComponent(); this._audio = base.GetComponent(); base.InvokeRepeating("PlayRandomSound", Random.value + 1f, 1f); if (this._scareSounds.Length != 0) { base.InvokeRepeating("ScareSound", 1f, 0.01f); } } // Token: 0x0600157E RID: 5502 RVA: 0x00199D18 File Offset: 0x00197F18 public void PlayRandomSound() { if (base.gameObject.activeInHierarchy) { if (!this._audio.isPlaying && this._flightSounds.Length != 0 && this._flightSoundRandomChance > Random.value && !this._flockChild._landing) { this._audio.clip = this._flightSounds[Random.Range(0, this._flightSounds.Length)]; this._audio.pitch = Random.Range(this._pitchMin, this._pitchMax); this._audio.volume = Random.Range(this._volumeMin, this._volumeMax); this._audio.Play(); return; } if (!this._audio.isPlaying && this._idleSounds.Length != 0 && this._idleSoundRandomChance > Random.value && this._flockChild._landing) { this._audio.clip = this._idleSounds[Random.Range(0, this._idleSounds.Length)]; this._audio.pitch = Random.Range(this._pitchMin, this._pitchMax); this._audio.volume = Random.Range(this._volumeMin, this._volumeMax); this._audio.Play(); this._hasLanded = true; } } } // Token: 0x0600157F RID: 5503 RVA: 0x00199E6C File Offset: 0x0019806C public void ScareSound() { if (base.gameObject.activeInHierarchy && this._hasLanded && !this._flockChild._landing && this._idleSoundRandomChance * 2f > Random.value) { this._audio.clip = this._scareSounds[Random.Range(0, this._scareSounds.Length)]; this._audio.volume = Random.Range(this._volumeMin, this._volumeMax); this._audio.PlayDelayed(Random.value * 0.2f); this._hasLanded = false; } } // Token: 0x04002561 RID: 9569 public AudioClip[] _idleSounds; // Token: 0x04002562 RID: 9570 public float _idleSoundRandomChance = 0.05f; // Token: 0x04002563 RID: 9571 public AudioClip[] _flightSounds; // Token: 0x04002564 RID: 9572 public float _flightSoundRandomChance = 0.05f; // Token: 0x04002565 RID: 9573 public AudioClip[] _scareSounds; // Token: 0x04002566 RID: 9574 public float _pitchMin = 0.85f; // Token: 0x04002567 RID: 9575 public float _pitchMax = 1f; // Token: 0x04002568 RID: 9576 public float _volumeMin = 0.6f; // Token: 0x04002569 RID: 9577 public float _volumeMax = 0.8f; // Token: 0x0400256A RID: 9578 private FlockChild _flockChild; // Token: 0x0400256B RID: 9579 private AudioSource _audio; // Token: 0x0400256C RID: 9580 private bool _hasLanded; }