Elin Modding Docs Doc
Loading...
Searching...
No Matches
ActorEx.cs
1using System;
2using UnityEngine;
3
4// Token: 0x02000171 RID: 369
5public class ActorEx : Actor
6{
7 // Token: 0x06000AC5 RID: 2757 RVA: 0x000426D0 File Offset: 0x000408D0
8 public void SetOwner(Card c)
9 {
10 this.owner = c;
11 if (this.type == ActorEx.Type.JukeBox)
12 {
13 this.data = EMono.core.refs.dictBGM.TryGetValue(this.owner.refVal, null);
14 }
15 if (this.audioSource)
16 {
17 this.audioSource.clip = this.data.clip;
18 this.audioSource.pitch = this.data.pitch * (1f + ((this.data.randomPitch == 0f) ? 0f : Rand.Range(-this.data.randomPitch, this.data.randomPitch)));
19 }
20 this.Refresh();
21 }
22
23 // Token: 0x06000AC6 RID: 2758 RVA: 0x00042790 File Offset: 0x00040990
24 public float GetVolume()
25 {
26 if (!EMono._zone.isStarted)
27 {
28 return 0f;
29 }
30 Room room = EMono.pc.Cell.room;
31 Room room2 = this.owner.Cell.room;
32 bool flag = room2 == null || room2.data.atrium || !room2.HasRoof;
33 bool flag2 = room == room2 || (room2 == null && (room.data.atrium || !room.HasRoof));
34 bool flag3 = flag2 || ((room != null) ? room.lot : null) == ((room2 != null) ? room2.lot : null);
35 float num = (this.alwaysOn || this.owner.isOn) ? 1f : 0f;
36 if (!flag3)
37 {
38 num *= this.outsideLotVolume;
39 }
40 if (!flag2 && room2 != null)
41 {
42 num *= this.outsideRoomVolume;
43 }
44 if (num <= 0f)
45 {
46 return 0f;
47 }
48 if (this.type == ActorEx.Type.JukeBox)
49 {
50 num *= 0.5f + (flag ? 0.25f : 0f);
51 if (flag2)
52 {
53 int num2 = EMono.pc.Dist(this.owner);
54 if (num2 < 8)
55 {
56 float num3 = (float)(8 - num2) * SoundManager.current.jukeboxMod - 0.2f;
57 if (num3 < SoundManager.bgmDumpMod)
58 {
59 SoundManager.bgmDumpMod = num3;
60 }
61 }
62 }
63 }
64 return num;
65 }
66
67 // Token: 0x06000AC7 RID: 2759 RVA: 0x000428EC File Offset: 0x00040AEC
68 public unsafe void Refresh()
69 {
70 if (this.owner.parent != EMono.pc.currentZone)
71 {
72 Debug.LogWarning(this.owner);
73 return;
74 }
75 this.next--;
76 if (this.next > 0)
77 {
78 return;
79 }
80 this.next = this.minInterval + Rand.rnd(this.randomInterval + 1);
81 if (this.maxDistance != 0)
82 {
83 int num = EMono.pc.Dist(this.owner);
84 if (base.gameObject.activeSelf)
85 {
86 if (num > this.maxDistance)
87 {
88 base.gameObject.SetActive(false);
89 return;
90 }
91 }
92 else
93 {
94 if (num > this.maxDistance)
95 {
96 return;
97 }
98 base.gameObject.SetActive(true);
99 }
100 }
101 float volume = this.GetVolume();
102 if (this.maxDistance != 0)
103 {
104 base.gameObject.SetActive(volume > 0f);
105 }
106 if (this.audioSource)
107 {
108 this.audioSource.volume = this.data.volume * volume;
109 if (!this.audioSource.isPlaying && volume > 0f)
110 {
111 this.audioSource.Play();
112 }
113 }
114 if (volume <= 0f)
115 {
116 return;
117 }
118 Vector3 vector = *this.owner.pos.PositionCenter();
119 vector.z = 0f;
120 if (this.audioSource)
121 {
122 base.transform.position = vector;
123 return;
124 }
125 SoundManager.current.Play(this.data, vector, volume);
126 }
127
128 // Token: 0x06000AC8 RID: 2760 RVA: 0x00042A61 File Offset: 0x00040C61
129 public void Kill()
130 {
131 UnityEngine.Object.Destroy(base.gameObject);
132 }
133
134 // Token: 0x040009DD RID: 2525
135 public ActorEx.Type type;
136
137 // Token: 0x040009DE RID: 2526
138 public Card owner;
139
140 // Token: 0x040009DF RID: 2527
141 public bool alwaysOn;
142
143 // Token: 0x040009E0 RID: 2528
144 public float outsideRoomVolume = 0.5f;
145
146 // Token: 0x040009E1 RID: 2529
147 public float outsideLotVolume = 0.5f;
148
149 // Token: 0x040009E2 RID: 2530
150 public int maxDistance;
151
152 // Token: 0x040009E3 RID: 2531
153 public int minInterval = 1;
154
155 // Token: 0x040009E4 RID: 2532
156 public int randomInterval;
157
158 // Token: 0x040009E5 RID: 2533
159 private int next;
160
161 // Token: 0x040009E6 RID: 2534
162 public AudioSource audioSource;
163
164 // Token: 0x040009E7 RID: 2535
165 public SoundData data;
166
167 // Token: 0x02000881 RID: 2177
168 public enum Type
169 {
170 // Token: 0x04002465 RID: 9317
171 Default,
172 // Token: 0x04002466 RID: 9318
173 JukeBox
174 }
175}
Definition Actor.cs:5
Definition Card.cs:13
Definition EMono.cs:6
Definition Room.cs:6