Esempio n. 1
0
 public void PlayLoop()
 {
     if (_sound == null)
     {
         return;
     }
     _sound.PlayLoop(_audioSource);
 }
Esempio n. 2
0
    /// <summary>
    /// Plays the ParticleSystem and all the children ParticleSystems.
    /// </summary>
    public void Play()
    {
        if (!_isInitialized)
        {
            InitializeParticleSystem();
        }

        if (_particleSystem == null)
        {
            return;
        }

        _particleSystem.Play(true);

        if (_playSFX)
        {
            if (_soundIndex < 0)
            {
                if (_particleSystem.main.loop)
                {
                    _soundData.PlayLoop(_audioSource);
                }
                else
                {
                    _soundData.PlayOneShot(_audioSource);
                }
            }
            else
            {
                if (_particleSystem.main.loop)
                {
                    _soundData.PlayLoop(_audioSource, _soundIndex);
                }
                else
                {
                    _soundData.PlayOneShot(_audioSource, _soundIndex);
                }
            }
        }

        StartCoroutine(ParticlesAliveCheck());
    }