Beispiel #1
0
    public SoundItem play(string url, bool loop = false, GameObject obj = null)
    {
        if (string.IsNullOrEmpty(url))
        {
            return(null);
        }

        if (singleChangleDuration != 0)
        {
            SoundItem I = (SoundItem)singleChangleCatch[url];
            if (I != null)
            {
                if (singleChangleDuration == -1 && !I.isOver())
                {
                    return(null);
                }
                else if (Time.time - I.lastPlayTime < singleChangleDuration)
                {
                    return(null);
                }
            }
        }
        SoundPlayer _player = SoundManager.getSound(url);
        SoundItem   c       = _player.playSound(loop, loadOverToPlay, obj);

        if (mute)
        {
            c.mute = mute;
        }

        addSoundItem(c);
        if (singleChangleDuration != 0)
        {
            singleChangleCatch[url] = c;
        }

        if (_voi != 1)
        {
            c.updateVolume();
        }
        return(c);
    }