private void Update()
    {
        if (drawParticleSystem != null)
        {
            if (queue.Count == 0 && current.Done)
            {
                drawParticleSystem.Stop();
            }
            else
            {
                drawParticleSystem.Play();

                // Set animation of particle system
                var col = drawParticleSystem.colorOverLifetime;

                Gradient gradient = new Gradient();
                gradient.SetKeys(new GradientColorKey[] { new GradientColorKey(lineRenderer.startColor, 0.8f), new GradientColorKey(Color.white, 1f) }, new GradientAlphaKey[] { new GradientAlphaKey(1f, .5f), new GradientAlphaKey(0.1f, 1f) });
                col.color = gradient;
            }
        }

        // Play audio if we need to after each other
        if (drawSounds != null)
        {
            if (queue.Count > 0)
            {
                if (!audioSource.isPlaying)
                {
                    drawSounds.PlayRandomAudioNonRepeat(audioSource);
                }
            }
            else if (queue.Count == 0 && current.Done)
            {
                audioSource.Stop();
            }
        }

        ProcessCurrent();
    }
Пример #2
0
 public void PlayORandomPlaceSound(AudioSource source)
 {
     oPlaceSounds.PlayRandomAudioNonRepeat(source);
 }