Example #1
0
    public void Play(int index)
    {
        if (index >= sounds.Length)
        {
            return;
        }
        Sound_game s = sounds[index];

        s.source.Play();
    }
Example #2
0
    public void StopPlaying(int index)
    {
        if (index < 0)
        {
            return;
        }
        Sound_game s = sounds[index];

        s.source.Stop();
    }
Example #3
0
    public void Play(string str)
    {
        Sound_game s = Array.Find(sounds, sound => sound.name == str);

        if (s == null)
        {
            return;
        }
        s.source.Play();
    }