Пример #1
0
    private IEnumerator TimeDelay()
    {
        yield return(new WaitForSeconds(ParticleDelay));

        ParticleSystem.Particle[] particles = new ParticleSystem.Particle[Particlefollow.particleCount];

        while (true)
        {
            particles = new ParticleSystem.Particle[Particlefollow.particleCount];
            Particlefollow.GetParticles(particles);

            // Modifying the particles
            for (int i = 0; i < particles.GetLength(0); i++)
            {
                float ForceToAdd = (particles[i].startLifetime - particles[i].remainingLifetime) * (SpeedMult * Vector3.Distance(Target.position, particles[i].position));
                particles[i].velocity = (Target.position - particles[i].position).normalized * ForceToAdd;
            }

            Particlefollow.SetParticles(particles, particles.Length);

            yield return(null);
        }
    }