8 private void OnEnable()
11 base.InvokeRepeating(
"Refresh", 0f, 0.1f);
15 private void OnDisable()
23 this.source.clip = this.data.clip;
24 this.source.loop = (this.data.loop != 0);
25 this.source.volume = this.data.volume;
26 this.source.pitch = this.data.pitch * (1f + ((this.data.randomPitch == 0f) ? 0f : Rand.Range(-this.data.randomPitch,
this.data.randomPitch)));
27 this.source.time = this.data.startAt;
28 this.source.name = this.data.name;
29 this.source.spatialBlend = 0f;
36 Vector3 vector = base.transform.position -
EMono.scene.transAudio.position;
38 float magnitude = vector.magnitude;
39 float num = Mathf.Clamp01(1f - magnitude / this.maxDistance);
40 this.source.volume = this.data.volume * num * this.data.spatial + this.data.volume * (1f - this.data.spatial);
47 public AudioSource source;
50 public SoundData data;
53 public float maxDistance;