Setup and play area prefab
This commit is contained in:
parent
fe61df43e7
commit
af12b601fc
166 changed files with 14014 additions and 10 deletions
26
WizardDuelsProject/Assets/Scripts/SoundGroup.cs
Normal file
26
WizardDuelsProject/Assets/Scripts/SoundGroup.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue