Elin Decompiled Documentation EA 23.270 Nightly Patch 1
Loading...
Searching...
No Matches
ActorEx.cs
Go to the documentation of this file.
1using UnityEngine;
2
3public class ActorEx : Actor
4{
5 public enum Type
6 {
9 }
10
11 public Type type;
12
13 public Card owner;
14
15 public bool alwaysOn;
16
17 public float outsideRoomVolume = 0.5f;
18
19 public float outsideLotVolume = 0.5f;
20
21 public int maxDistance;
22
23 public int minInterval = 1;
24
25 public int randomInterval;
26
27 private int next;
28
29 public AudioSource audioSource;
30
31 public SoundData data;
32
33 public void SetOwner(Card c)
34 {
35 owner = c;
36 if (type == Type.JukeBox)
37 {
38 data = EMono.core.refs.dictBGM.TryGetValue(owner.refVal);
39 }
40 if ((bool)audioSource && (bool)data)
41 {
42 audioSource.clip = data.clip;
43 audioSource.pitch = data.pitch * (1f + ((data.randomPitch == 0f) ? 0f : Rand.Range(0f - data.randomPitch, data.randomPitch)));
44 }
45 Refresh();
46 }
47
48 public float GetVolume()
49 {
51 {
52 return 0f;
53 }
54 Room room = EMono.pc.Cell.room;
55 Room room2 = owner.Cell.room;
56 bool flag = room2 == null || room2.data.atrium || !room2.HasRoof;
57 bool flag2 = room == room2 || (room2 == null && (room.data.atrium || !room.HasRoof));
58 bool num = flag2 || room?.lot == room2?.lot;
59 float num2 = ((alwaysOn || owner.isOn) ? 1f : 0f);
60 if (!num)
61 {
62 num2 *= outsideLotVolume;
63 }
64 if (!flag2 && room2 != null)
65 {
66 num2 *= outsideRoomVolume;
67 }
68 if (num2 <= 0f)
69 {
70 return 0f;
71 }
72 if (type == Type.JukeBox)
73 {
74 num2 *= 0.5f + (flag ? 0.25f : 0f);
75 if (flag2)
76 {
77 int num3 = EMono.pc.Dist(owner);
78 if (num3 < 8)
79 {
80 float num4 = (float)(8 - num3) * SoundManager.current.jukeboxMod - 0.2f;
81 if (num4 < SoundManager.bgmDumpMod)
82 {
83 SoundManager.bgmDumpMod = num4;
84 }
85 }
86 }
87 }
88 return num2;
89 }
90
91 public void Refresh()
92 {
93 if (!data)
94 {
95 return;
96 }
98 {
99 Debug.LogWarning(owner);
100 return;
101 }
102 next--;
103 if (next > 0)
104 {
105 return;
106 }
108 if (maxDistance != 0)
109 {
110 int num = EMono.pc.Dist(owner);
111 if (base.gameObject.activeSelf)
112 {
113 if (num > maxDistance)
114 {
115 base.gameObject.SetActive(value: false);
116 return;
117 }
118 }
119 else
120 {
121 if (num > maxDistance)
122 {
123 return;
124 }
125 base.gameObject.SetActive(value: true);
126 }
127 }
128 float volume = GetVolume();
129 if (maxDistance != 0)
130 {
131 base.gameObject.SetActive(volume > 0f);
132 }
133 if ((bool)audioSource)
134 {
135 audioSource.volume = data.volume * volume;
136 if (!audioSource.isPlaying && volume > 0f)
137 {
138 audioSource.Play();
139 }
140 }
141 if (!(volume <= 0f))
142 {
143 Vector3 vector = owner.pos.PositionCenter();
144 vector.z = 0f;
145 vector.x -= 0.64f;
146 if ((bool)audioSource)
147 {
148 base.transform.position = vector;
149 }
150 else
151 {
152 SoundManager.current.Play(data, vector, volume);
153 }
154 }
155 }
156
157 public void Kill()
158 {
159 Object.Destroy(base.gameObject);
160 }
161}
void SetOwner(Card c)
Definition: ActorEx.cs:33
void Refresh()
Definition: ActorEx.cs:91
int next
Definition: ActorEx.cs:27
Type
Definition: ActorEx.cs:6
AudioSource audioSource
Definition: ActorEx.cs:29
int randomInterval
Definition: ActorEx.cs:25
Card owner
Definition: ActorEx.cs:13
SoundData data
Definition: ActorEx.cs:31
float outsideRoomVolume
Definition: ActorEx.cs:17
int minInterval
Definition: ActorEx.cs:23
float GetVolume()
Definition: ActorEx.cs:48
bool alwaysOn
Definition: ActorEx.cs:15
void Kill()
Definition: ActorEx.cs:157
int maxDistance
Definition: ActorEx.cs:21
Type type
Definition: ActorEx.cs:11
float outsideLotVolume
Definition: ActorEx.cs:19
Definition: Actor.cs:2
Definition: Card.cs:11
ICardParent parent
Definition: Card.cs:56
Point pos
Definition: Card.cs:60
int refVal
Definition: Card.cs:207
bool IsInstalled
Definition: Card.cs:2384
int Dist(Card c)
Definition: Card.cs:7838
bool isOn
Definition: Card.cs:543
Cell Cell
Definition: Card.cs:2056
Room room
Definition: Cell.cs:102
Zone currentZone
Definition: Chara.cs:257
Dictionary< int, BGMData > dictBGM
Definition: CoreRef.cs:385
CoreRef refs
Definition: Core.cs:51
Definition: EMono.cs:4
static Core core
Definition: EMono.cs:5
static Chara pc
Definition: EMono.cs:13
static Zone _zone
Definition: EMono.cs:19
ref Vector3 PositionCenter()
Definition: Point.cs:587
Definition: Rand.cs:4
static int Range(int min, int max)
Definition: Rand.cs:42
static int rnd(int max)
Definition: Rand.cs:52
Definition: Room.cs:4
bool HasRoof
Definition: Room.cs:29
Lot lot
Definition: Room.cs:21
bool isStarted
Definition: Zone.cs:73