26 lines
No EOL
532 B
C#
26 lines
No EOL
532 B
C#
using System;
|
|
using System.Linq;
|
|
|
|
namespace DefaultNamespace
|
|
{
|
|
[System.Serializable]
|
|
public class SoundGroup
|
|
{
|
|
public string name;
|
|
public Sound[] sounds;
|
|
|
|
private int index;
|
|
|
|
public void Play()
|
|
{
|
|
if (index >= sounds.Length)
|
|
{
|
|
// Shuffle the sounds
|
|
sounds = sounds.OrderBy(s => Guid.NewGuid()).ToArray();
|
|
index = 0;
|
|
}
|
|
sounds[index].source.Play();
|
|
index++;
|
|
}
|
|
}
|
|
} |