8 public void SetOwner(
Card c)
11 if (this.type ==
ActorEx.Type.JukeBox)
13 this.data =
EMono.core.refs.dictBGM.TryGetValue(this.owner.refVal,
null);
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)));
24 public float GetVolume()
26 if (!
EMono._zone.isStarted)
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;
38 num *= this.outsideLotVolume;
40 if (!flag2 && room2 !=
null)
42 num *= this.outsideRoomVolume;
48 if (this.type ==
ActorEx.Type.JukeBox)
50 num *= 0.5f + (flag ? 0.25f : 0f);
53 int num2 =
EMono.pc.Dist(this.owner);
56 float num3 = (float)(8 - num2) * SoundManager.current.jukeboxMod - 0.2f;
57 if (num3 < SoundManager.bgmDumpMod)
59 SoundManager.bgmDumpMod = num3;
68 public unsafe
void Refresh()
70 if (this.owner.parent !=
EMono.pc.currentZone)
72 Debug.LogWarning(this.owner);
80 this.next = this.minInterval + Rand.rnd(this.randomInterval + 1);
81 if (this.maxDistance != 0)
83 int num =
EMono.pc.Dist(this.owner);
84 if (base.gameObject.activeSelf)
86 if (num > this.maxDistance)
88 base.gameObject.SetActive(
false);
94 if (num > this.maxDistance)
98 base.gameObject.SetActive(
true);
101 float volume = this.GetVolume();
102 if (this.maxDistance != 0)
104 base.gameObject.SetActive(volume > 0f);
106 if (this.audioSource)
108 this.audioSource.volume = this.data.volume * volume;
109 if (!this.audioSource.isPlaying && volume > 0f)
111 this.audioSource.Play();
118 Vector3 vector = *this.owner.pos.PositionCenter();
120 if (this.audioSource)
122 base.transform.position = vector;
125 SoundManager.current.Play(this.data, vector, volume);
131 UnityEngine.Object.Destroy(base.gameObject);
135 public ActorEx.Type type;
141 public bool alwaysOn;
144 public float outsideRoomVolume = 0.5f;
147 public float outsideLotVolume = 0.5f;
150 public int maxDistance;
153 public int minInterval = 1;
156 public int randomInterval;
162 public AudioSource audioSource;
165 public SoundData data;