示例#1
0
    public void Play(string name)
    {
        T10_Sound s = Array.Find(sounds, sound => sound.name == name);

        if (s == null)
        {
            Debug.LogWarning("Sound : " + name + "not found!");
            return;
        }

        s.source.volume = s.volume;
        s.source.Play();
    }
示例#2
0
    public void StopPlaying(string sound)
    {
        T10_Sound s = Array.Find(sounds, item => item.name == sound);

        if (s == null)
        {
            Debug.LogWarning("Sound: " + name + " not found!");
            return;
        }

        s.source.volume = s.volume;
        s.source.pitch  = s.pitch;

        s.source.Stop();
    }