public void Play(int index) { if (index >= sounds.Length) { return; } Sound_game s = sounds[index]; s.source.Play(); }
public void StopPlaying(int index) { if (index < 0) { return; } Sound_game s = sounds[index]; s.source.Stop(); }
public void Play(string str) { Sound_game s = Array.Find(sounds, sound => sound.name == str); if (s == null) { return; } s.source.Play(); }