Example #1
0
    //---------------------------------------------------
    //				PUBLIC_METHODS_PLAY&STOP
    //---------------------------------------------------
    #region PUBLIC_METHODS_PLAY&STOP

    public void PlayOneShot()
    {
        if (_sound == null)
        {
            return;
        }
        _sound.PlayOneShot(_audioSource);
    }
Example #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());
    }