@@ -28,6 +28,9 @@ public class AutoType : MonoBehaviour {
28
28
public List < string > choicesLinksList ;
29
29
public List < string > speakersList ;
30
30
public List < string > contentList ;
31
+ public AudioSource [ ] remySources ;
32
+ public AudioSource [ ] judgeSources ;
33
+ public AudioSource [ ] comcastSources ;
31
34
32
35
// Use this for initialization
33
36
void Start ( ) {
@@ -40,6 +43,10 @@ void Start () {
40
43
comcast . enabled = false ;
41
44
judge . enabled = false ;
42
45
explosion . enabled = false ;
46
+ remySources = remyAudio . GetComponents < AudioSource > ( ) ;
47
+ judgeSources = judgeAudio . GetComponents < AudioSource > ( ) ;
48
+ comcastSources = comcastAudio . GetComponents < AudioSource > ( ) ;
49
+
43
50
44
51
// remyClips[0] = AudioClip.Create("R_eh-eh.mp3", 44100, 1, 44100, false, true);
45
52
// remyClips[1] = AudioClip.Create("R_Hmmmm.mp3", 44100, 1, 44100, false, true);
@@ -281,19 +288,22 @@ IEnumerator createMessage()
281
288
if ( speaker == "Flossopher" )
282
289
{
283
290
remy . enabled = true ;
284
- remyAudio . Play ( ) ;
291
+ remySources [ Random . Range ( 0 , remySources . Length ) ] . Play ( ) ;
292
+ //remyAudio.Play();
285
293
}
286
294
if ( speaker == "Comcast" )
287
295
{
288
296
comcast . enabled = true ;
289
- comcastAudio . Play ( ) ;
297
+ comcastSources [ Random . Range ( 0 , comcastSources . Length ) ] . Play ( ) ;
298
+ //comcastAudio.Play();
290
299
}
291
300
if ( speaker == "Judge" )
292
301
{
293
302
judge . enabled = true ;
294
- judgeAudio . Play ( ) ;
303
+ judgeSources [ Random . Range ( 0 , judgeSources . Length ) ] . Play ( ) ;
304
+ //judgeAudio.Play();
295
305
}
296
- foreach ( char letter in contentList [ i ] )
306
+ foreach ( char letter in ( speakersList [ i ] + ": " + contentList [ i ] ) )
297
307
{
298
308
message += letter ;
299
309
yield return 0 ;
@@ -318,17 +328,20 @@ IEnumerator createMessage()
318
328
if ( speaker == "Flossopher" )
319
329
{
320
330
remy . enabled = true ;
321
- remyAudio . Play ( ) ;
331
+ remySources [ Random . Range ( 0 , remySources . Length ) ] . Play ( ) ;
332
+ //remyAudio.Play();
322
333
}
323
334
if ( speaker == "Comcast" )
324
335
{
325
336
comcast . enabled = true ;
326
- comcastAudio . Play ( ) ;
337
+ comcastSources [ Random . Range ( 0 , comcastSources . Length ) ] . Play ( ) ;
338
+ //comcastAudio.Play();
327
339
}
328
340
if ( speaker == "Judge" )
329
341
{
330
342
judge . enabled = true ;
331
- judgeAudio . Play ( ) ;
343
+ judgeSources [ Random . Range ( 0 , judgeSources . Length ) ] . Play ( ) ;
344
+ //udgeAudio.Play();
332
345
}
333
346
foreach ( char letter in Twine . TwineData . Current . ContentData . ToString ( ) )
334
347
{
0 commit comments