Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
ESoundSource Class Reference
Inheritance diagram for ESoundSource:
EMono

Public Member Functions

void Play ()
 
void Refresh ()
 

Public Attributes

TC owner
 
AudioSource source
 
SoundData data
 
float maxDistance
 

Private Member Functions

void OnEnable ()
 
void OnDisable ()
 

Additional Inherited Members

- Static Public Member Functions inherited from EMono
static int rnd (int a)
 
- Static Public Attributes inherited from EMono
static Core core
 
- 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 3 of file ESoundSource.cs.

Member Function Documentation

◆ OnDisable()

void ESoundSource.OnDisable ( )
inlineprivate

Definition at line 19 of file ESoundSource.cs.

20 {
21 CancelInvoke();
22 }

◆ OnEnable()

void ESoundSource.OnEnable ( )
inlineprivate

Definition at line 13 of file ESoundSource.cs.

14 {
15 Play();
16 InvokeRepeating("Refresh", 0f, 0.1f);
17 }

References Play().

◆ Play()

void ESoundSource.Play ( )
inline

Definition at line 24 of file ESoundSource.cs.

25 {
26 source.clip = data.clip;
27 source.loop = data.loop != 0;
28 source.volume = data.volume;
29 source.pitch = data.pitch * (1f + ((data.randomPitch == 0f) ? 0f : Rand.Range(0f - data.randomPitch, data.randomPitch)));
30 source.time = data.startAt;
31 source.name = data.name;
32 source.spatialBlend = 0f;
33 source.Play();
34 }
SoundData data
Definition: ESoundSource.cs:9
AudioSource source
Definition: ESoundSource.cs:7
Definition: Rand.cs:4
static int Range(int min, int max)
Definition: Rand.cs:42

References data, Rand.Range(), and source.

Referenced by OnEnable().

◆ Refresh()

void ESoundSource.Refresh ( )
inline

Definition at line 36 of file ESoundSource.cs.

37 {
38 Vector3 vector = base.transform.position - EMono.scene.transAudio.position;
39 vector.z = 0f;
40 float magnitude = vector.magnitude;
41 float num = Mathf.Clamp01(1f - magnitude / maxDistance);
42 source.volume = data.volume * num * data.spatial + data.volume * (1f - data.spatial);
43 }
Definition: EMono.cs:4
static Scene scene
Definition: EMono.cs:27
float maxDistance
Definition: ESoundSource.cs:11
Transform transAudio
Definition: Scene.cs:31

References data, maxDistance, EMono.scene, and Scene.transAudio.

Member Data Documentation

◆ data

SoundData ESoundSource.data

Definition at line 9 of file ESoundSource.cs.

Referenced by Play(), and Refresh().

◆ maxDistance

float ESoundSource.maxDistance

Definition at line 11 of file ESoundSource.cs.

Referenced by Refresh().

◆ owner

TC ESoundSource.owner

Definition at line 5 of file ESoundSource.cs.

◆ source

AudioSource ESoundSource.source

Definition at line 7 of file ESoundSource.cs.

Referenced by Play().


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