Exemplo n.º 1
0
    private IEnumerator Play()
    {
        if (_randomizeStartDelay)
        {
            yield return(new WaitForSeconds(Random.Range(0.0f, _delay)));
        }

        while (true)
        {
            yield return(new WaitForSeconds(_delay + Random.Range(0.0f, _randomDelay)));

            _particleSpawner.Burst(_duration, _normalizedDensity, null);
        }
    }
Exemplo n.º 2
0
    private IEnumerator Play()
    {
        _audioSource.playOnAwake = false;
        _audioSource.loop        = false;

        if (_randomizeStartDelay)
        {
            yield return(new WaitForSeconds(Random.Range(0.0f, _delay)));
        }

        while (true)
        {
            yield return(new WaitForSeconds(_delay));

            _audioSource.PlayOneShot(_clips[Random.Range(0, _clips.Length)]);
            _particleSpawner.Burst(_duration, _normalizedDensity, null);
        }
    }