Skip to content

Commit 9eef801

Browse files
Stephen HodgsonStephen Hodgson
authored andcommitted
UAudioManager introduced optional param to one of the PlayEvents to reduce the amount of code.
1 parent 4a3587a commit 9eef801

File tree

1 file changed

+4
-28
lines changed

1 file changed

+4
-28
lines changed

Assets/HoloToolkit/SpatialSound/Scripts/UAudioManager/UAudioManager.cs

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -73,22 +73,7 @@ public void PlayEvent(string eventName)
7373
/// <param name="messageOnAudioEnd">The Message to Send to the GameObject when the sound has finished playing.</param>
7474
public void PlayEvent(string eventName, GameObject emitter, string messageOnAudioEnd = null)
7575
{
76-
PlayEvent(
77-
eventName,
78-
emitter,
79-
null,
80-
null,
81-
messageOnAudioEnd);
82-
}
83-
84-
/// <summary>
85-
/// Plays an AudioEvent.
86-
/// </summary>
87-
/// <param name="eventName">The name associated with the AudioEvent.</param>
88-
/// <param name="primarySource">The AudioSource component to use as the primary source for the event.</param>
89-
public void PlayEvent(string eventName, AudioSource primarySource)
90-
{
91-
PlayEvent(eventName, primarySource, null);
76+
PlayEvent(eventName, emitter, null, null, messageOnAudioEnd);
9277
}
9378

9479
/// <summary>
@@ -97,14 +82,9 @@ public void PlayEvent(string eventName, AudioSource primarySource)
9782
/// <param name="eventName">The name associated with the AudioEvent.</param>
9883
/// <param name="primarySource">The AudioSource component to use as the primary source for the event.</param>
9984
/// <param name="secondarySource">The AudioSource component to use as the secondary source for the event.</param>
100-
public void PlayEvent(string eventName,
101-
AudioSource primarySource,
102-
AudioSource secondarySource)
85+
public void PlayEvent(string eventName, AudioSource primarySource, AudioSource secondarySource = null)
10386
{
104-
PlayEvent(eventName,
105-
primarySource.gameObject,
106-
primarySource,
107-
secondarySource);
87+
PlayEvent(eventName, primarySource.gameObject, primarySource, secondarySource);
10888
}
10989

11090
/// <summary>
@@ -115,11 +95,7 @@ public void PlayEvent(string eventName,
11595
/// <param name="primarySource">The AudioSource component to use as the primary source for the event.</param>
11696
/// <param name="secondarySource">The AudioSource component to use as the secondary source for the event.</param>
11797
/// <param name="messageOnAudioEnd">The Message to Send to the GameObject when the sound has finished playing.</param>
118-
private void PlayEvent(string eventName,
119-
GameObject emitter,
120-
AudioSource primarySource,
121-
AudioSource secondarySource,
122-
string messageOnAudioEnd = null)
98+
private void PlayEvent(string eventName, GameObject emitter, AudioSource primarySource, AudioSource secondarySource, string messageOnAudioEnd = null)
12399
{
124100
if (!CanPlayNewEvent())
125101
{

0 commit comments

Comments
 (0)