Elin Decompiled Documentation EA 23.357 Nightly
Loading...
Searching...
No Matches
ActorEx Class Reference
Inheritance diagram for ActorEx:
Actor SceneObject EMono

Public Types

enum  Type { Default , JukeBox }
 

Public Member Functions

void SetOwner (Card c)
 
float GetVolume ()
 
void Refresh ()
 
void Kill ()
 

Public Attributes

Type type
 
Card owner
 
bool alwaysOn
 
float outsideRoomVolume = 0.5f
 
float outsideLotVolume = 0.5f
 
int maxDistance
 
int minInterval = 1
 
int randomInterval
 
AudioSource audioSource
 
SoundData data
 

Static Public Attributes

static readonly List< ActorEx > instances = new List<ActorEx>()
 
- Static Public Attributes inherited from EMono
static Core core
 

Private Member Functions

void OnEnable ()
 
void OnDisable ()
 
void RefreshNearbyCounts ()
 
void UpdateSameSoundCount ()
 

Private Attributes

int next
 
int sameSoundCount = 1
 

Additional Inherited Members

- Static Public Member Functions inherited from EMono
static int rnd (int a)
 
- Properties inherited from EMono
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SoundManager Sound [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static CoreDebug debug [get]
 

Detailed Description

Definition at line 4 of file ActorEx.cs.

Member Enumeration Documentation

◆ Type

Enumerator
Default 
JukeBox 

Definition at line 6 of file ActorEx.cs.

7 {
10 }

Member Function Documentation

◆ GetVolume()

float ActorEx.GetVolume ( )
inline

Definition at line 54 of file ActorEx.cs.

55 {
57 {
58 return 0f;
59 }
60 Room room = EMono.pc.Cell.room;
61 Room room2 = owner.Cell.room;
62 bool flag = room2 == null || room2.data.atrium || !room2.HasRoof;
63 bool flag2 = room == room2 || (room2 == null && (room.data.atrium || !room.HasRoof));
64 bool num = flag2 || room?.lot == room2?.lot;
65 float num2 = ((alwaysOn || owner.isOn) ? 1f : 0f);
66 if (!num)
67 {
68 num2 *= outsideLotVolume;
69 }
70 if (!flag2 && room2 != null)
71 {
72 num2 *= outsideRoomVolume;
73 }
74 num2 /= (float)sameSoundCount;
75 if (num2 <= 0f)
76 {
77 return 0f;
78 }
79 if (type == Type.JukeBox)
80 {
81 num2 *= 0.5f + (flag ? 0.25f : 0f);
82 if (flag2)
83 {
84 int num3 = EMono.pc.Dist(owner);
85 if (num3 < 8)
86 {
87 float num4 = (float)(8 - num3) * SoundManager.current.jukeboxMod - 0.2f;
88 if (num4 < SoundManager.bgmDumpMod)
89 {
90 SoundManager.bgmDumpMod = num4;
91 }
92 }
93 }
94 }
95 return num2;
96 }
Type
Definition: ActorEx.cs:7
Card owner
Definition: ActorEx.cs:16
float outsideRoomVolume
Definition: ActorEx.cs:20
bool alwaysOn
Definition: ActorEx.cs:18
int sameSoundCount
Definition: ActorEx.cs:36
Type type
Definition: ActorEx.cs:14
float outsideLotVolume
Definition: ActorEx.cs:22
bool IsInstalled
Definition: Card.cs:2451
int Dist(Card c)
Definition: Card.cs:8241
bool isOn
Definition: Card.cs:545
Cell Cell
Definition: Card.cs:2107
Room room
Definition: Cell.cs:122
bool keepAmbientBGM
Definition: DramaManager.cs:83
Definition: EMono.cs:4
static Chara pc
Definition: EMono.cs:13
static Zone _zone
Definition: EMono.cs:19
static LayerDrama Instance
Definition: LayerDrama.cs:20
DramaManager drama
Definition: LayerDrama.cs:28
Definition: Room.cs:4
bool HasRoof
Definition: Room.cs:29
Lot lot
Definition: Room.cs:21
bool isStarted
Definition: Zone.cs:76

References EMono._zone, alwaysOn, Card.Cell, Card.Dist(), LayerDrama.drama, Room.HasRoof, LayerDrama.Instance, Card.IsInstalled, Card.isOn, Zone.isStarted, DramaManager.keepAmbientBGM, Room.lot, outsideLotVolume, outsideRoomVolume, owner, EMono.pc, Cell.room, sameSoundCount, and type.

Referenced by Refresh().

◆ Kill()

void ActorEx.Kill ( )
inline

Definition at line 164 of file ActorEx.cs.

165 {
166 Object.Destroy(base.gameObject);
167 }

Referenced by Scene.ClearActorEx(), and Scene.RemoveActorEx().

◆ OnDisable()

void ActorEx.OnDisable ( )
inlineprivate

Definition at line 178 of file ActorEx.cs.

179 {
180 instances.Remove(this);
182 }
void RefreshNearbyCounts()
Definition: ActorEx.cs:184
static readonly List< ActorEx > instances
Definition: ActorEx.cs:12

References instances, and RefreshNearbyCounts().

◆ OnEnable()

void ActorEx.OnEnable ( )
inlineprivate

Definition at line 169 of file ActorEx.cs.

170 {
171 if (!instances.Contains(this))
172 {
173 instances.Add(this);
174 }
176 }

References instances, and RefreshNearbyCounts().

◆ Refresh()

void ActorEx.Refresh ( )
inline

Definition at line 98 of file ActorEx.cs.

99 {
100 if (!data)
101 {
102 return;
103 }
105 {
106 Debug.LogWarning(owner);
107 return;
108 }
109 next--;
110 if (next > 0)
111 {
112 return;
113 }
115 if (maxDistance != 0)
116 {
117 int num = EMono.pc.Dist(owner);
118 if (base.gameObject.activeSelf)
119 {
120 if (num > maxDistance)
121 {
122 base.gameObject.SetActive(value: false);
123 return;
124 }
125 }
126 else
127 {
128 if (num > maxDistance)
129 {
130 return;
131 }
132 base.gameObject.SetActive(value: true);
133 }
134 }
135 float volume = GetVolume();
136 if (maxDistance != 0)
137 {
138 base.gameObject.SetActive(volume > 0f);
139 }
140 if ((bool)audioSource)
141 {
142 audioSource.volume = data.volume * volume;
143 if (!audioSource.isPlaying && volume > 0f)
144 {
145 audioSource.Play();
146 }
147 }
148 if (!(volume <= 0f))
149 {
150 Vector3 vector = owner.pos.PositionCenter();
151 vector.z = 0f;
152 vector.x -= 0.64f;
153 if ((bool)audioSource)
154 {
155 base.transform.position = vector;
156 }
157 else
158 {
159 SoundManager.current.Play(data, vector, volume);
160 }
161 }
162 }
int next
Definition: ActorEx.cs:30
AudioSource audioSource
Definition: ActorEx.cs:32
int randomInterval
Definition: ActorEx.cs:28
SoundData data
Definition: ActorEx.cs:34
int minInterval
Definition: ActorEx.cs:26
float GetVolume()
Definition: ActorEx.cs:54
int maxDistance
Definition: ActorEx.cs:24
ICardParent parent
Definition: Card.cs:56
Point pos
Definition: Card.cs:60
Zone currentZone
Definition: Chara.cs:261
ref Vector3 PositionCenter()
Definition: Point.cs:588
Definition: Rand.cs:4
static int rnd(int max)
Definition: Rand.cs:59

References audioSource, Chara.currentZone, data, Debug, Card.Dist(), GetVolume(), maxDistance, minInterval, next, owner, Card.parent, EMono.pc, Card.pos, Point.PositionCenter(), randomInterval, and Rand.rnd().

Referenced by Scene.RefreshActorEx(), and SetOwner().

◆ RefreshNearbyCounts()

void ActorEx.RefreshNearbyCounts ( )
inlineprivate

Definition at line 184 of file ActorEx.cs.

185 {
186 foreach (ActorEx instance in instances)
187 {
188 if ((bool)instance)
189 {
190 instance.UpdateSameSoundCount();
191 }
192 }
193 }

References instances.

Referenced by OnDisable(), OnEnable(), and SetOwner().

◆ SetOwner()

void ActorEx.SetOwner ( Card  c)
inline

Definition at line 38 of file ActorEx.cs.

39 {
40 owner = c;
41 if (type == Type.JukeBox)
42 {
43 data = EMono.core.refs.dictBGM.TryGetValue(owner.refVal);
44 }
45 if ((bool)audioSource && (bool)data)
46 {
47 audioSource.clip = data.clip;
48 audioSource.pitch = data.pitch * (1f + ((data.randomPitch == 0f) ? 0f : Rand.Range(0f - data.randomPitch, data.randomPitch)));
49 }
51 Refresh();
52 }
void Refresh()
Definition: ActorEx.cs:98
int refVal
Definition: Card.cs:209
Dictionary< int, BGMData > dictBGM
Definition: CoreRef.cs:388
CoreRef refs
Definition: Core.cs:51
static Core core
Definition: EMono.cs:5
static int Range(int min, int max)
Definition: Rand.cs:49

References audioSource, EMono.core, data, CoreRef.dictBGM, owner, Rand.Range(), Refresh(), RefreshNearbyCounts(), Core.refs, Card.refVal, and type.

Referenced by Scene.AddActorEx().

◆ UpdateSameSoundCount()

void ActorEx.UpdateSameSoundCount ( )
inlineprivate

Definition at line 195 of file ActorEx.cs.

196 {
197 sameSoundCount = 1;
198 if (!audioSource || !audioSource.clip)
199 {
200 return;
201 }
202 sameSoundCount = 0;
203 float num = 4f;
204 AudioClip clip = audioSource.clip;
205 Vector3 position = base.transform.position;
206 foreach (ActorEx instance in instances)
207 {
208 if ((bool)instance && (bool)instance.audioSource && !(instance.audioSource.clip != clip) && !((instance.transform.position - position).sqrMagnitude > num))
209 {
211 }
212 }
213 sameSoundCount = Mathf.Max(1, sameSoundCount);
214 }

References audioSource, instances, and sameSoundCount.

Member Data Documentation

◆ alwaysOn

bool ActorEx.alwaysOn

Definition at line 18 of file ActorEx.cs.

Referenced by GetVolume().

◆ audioSource

AudioSource ActorEx.audioSource

Definition at line 32 of file ActorEx.cs.

Referenced by Refresh(), SetOwner(), and UpdateSameSoundCount().

◆ data

SoundData ActorEx.data

Definition at line 34 of file ActorEx.cs.

Referenced by Refresh(), and SetOwner().

◆ instances

readonly List<ActorEx> ActorEx.instances = new List<ActorEx>()
static

Definition at line 12 of file ActorEx.cs.

Referenced by OnDisable(), OnEnable(), RefreshNearbyCounts(), and UpdateSameSoundCount().

◆ maxDistance

int ActorEx.maxDistance

Definition at line 24 of file ActorEx.cs.

Referenced by Refresh().

◆ minInterval

int ActorEx.minInterval = 1

Definition at line 26 of file ActorEx.cs.

Referenced by Refresh().

◆ next

int ActorEx.next
private

Definition at line 30 of file ActorEx.cs.

Referenced by Refresh().

◆ outsideLotVolume

float ActorEx.outsideLotVolume = 0.5f

Definition at line 22 of file ActorEx.cs.

Referenced by GetVolume().

◆ outsideRoomVolume

float ActorEx.outsideRoomVolume = 0.5f

Definition at line 20 of file ActorEx.cs.

Referenced by GetVolume().

◆ owner

Card ActorEx.owner

Definition at line 16 of file ActorEx.cs.

Referenced by GetVolume(), Refresh(), and SetOwner().

◆ randomInterval

int ActorEx.randomInterval

Definition at line 28 of file ActorEx.cs.

Referenced by Refresh().

◆ sameSoundCount

int ActorEx.sameSoundCount = 1
private

Definition at line 36 of file ActorEx.cs.

Referenced by GetVolume(), and UpdateSameSoundCount().

◆ type

Type ActorEx.type

Definition at line 14 of file ActorEx.cs.

Referenced by GetVolume(), and SetOwner().


The documentation for this class was generated from the following file: