Elin Modding Docs Doc
Loading...
Searching...
No Matches
ESoundSource.cs
1using System;
2using UnityEngine;
3
4// Token: 0x02000184 RID: 388
5public class ESoundSource : EMono
6{
7 // Token: 0x06000B25 RID: 2853 RVA: 0x000456F2 File Offset: 0x000438F2
8 private void OnEnable()
9 {
10 this.Play();
11 base.InvokeRepeating("Refresh", 0f, 0.1f);
12 }
13
14 // Token: 0x06000B26 RID: 2854 RVA: 0x0004570F File Offset: 0x0004390F
15 private void OnDisable()
16 {
17 base.CancelInvoke();
18 }
19
20 // Token: 0x06000B27 RID: 2855 RVA: 0x00045718 File Offset: 0x00043918
21 public void Play()
22 {
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;
30 this.source.Play();
31 }
32
33 // Token: 0x06000B28 RID: 2856 RVA: 0x00045804 File Offset: 0x00043A04
34 public void Refresh()
35 {
36 Vector3 vector = base.transform.position - EMono.scene.transAudio.position;
37 vector.z = 0f;
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);
41 }
42
43 // Token: 0x04000A35 RID: 2613
44 public TC owner;
45
46 // Token: 0x04000A36 RID: 2614
47 public AudioSource source;
48
49 // Token: 0x04000A37 RID: 2615
50 public SoundData data;
51
52 // Token: 0x04000A38 RID: 2616
53 public float maxDistance;
54}
Definition EMono.cs:6
Definition TC.cs:6