Elin Decompiled Documentation EA 23.102 Nightly
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)
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 {
94 {
95 Debug.LogWarning(owner);
96 return;
97 }
98 next--;
99 if (next > 0)
100 {
101 return;
102 }
104 if (maxDistance != 0)
105 {
106 int num = EMono.pc.Dist(owner);
107 if (base.gameObject.activeSelf)
108 {
109 if (num > maxDistance)
110 {
111 base.gameObject.SetActive(value: false);
112 return;
113 }
114 }
115 else
116 {
117 if (num > maxDistance)
118 {
119 return;
120 }
121 base.gameObject.SetActive(value: true);
122 }
123 }
124 float volume = GetVolume();
125 if (maxDistance != 0)
126 {
127 base.gameObject.SetActive(volume > 0f);
128 }
129 if ((bool)audioSource)
130 {
131 audioSource.volume = data.volume * volume;
132 if (!audioSource.isPlaying && volume > 0f)
133 {
134 audioSource.Play();
135 }
136 }
137 if (!(volume <= 0f))
138 {
139 Vector3 vector = owner.pos.PositionCenter();
140 vector.z = 0f;
141 vector.x -= 0.64f;
142 if ((bool)audioSource)
143 {
144 base.transform.position = vector;
145 }
146 else
147 {
148 SoundManager.current.Play(data, vector, volume);
149 }
150 }
151 }
152
153 public void Kill()
154 {
155 Object.Destroy(base.gameObject);
156 }
157}
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:153
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:51
Point pos
Definition: Card.cs:55
int refVal
Definition: Card.cs:190
bool IsInstalled
Definition: Card.cs:2241
int Dist(Card c)
Definition: Card.cs:6777
bool isOn
Definition: Card.cs:514
Cell Cell
Definition: Card.cs:1931
Room room
Definition: Cell.cs:102
Zone currentZone
Definition: Chara.cs:240
Dictionary< int, BGMData > dictBGM
Definition: CoreRef.cs:369
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:563
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:70