Esempio n. 1
0
 float dRad(Particle p)
 {
     var l = p.Lifetime / p.MaxLifetime;
     var initRate = InitRadius / 25;
     return initRate * (1 + l) * (1 - l);
 }
Esempio n. 2
0
        void init(Vector2 cent, float blastRad, int numParts, float maxLife, float initRad, float pmass, float maxangspd)
        {
            _cent = cent;
            Particles = new List<Particle>();
            InitRadius = initRad;

            for (int i = 0; i < numParts; i++)
            {
                var life = maxLife / 2 + (float)MathUtils.Rand.NextDouble() * maxLife / 2;
                var p = new Particle(InitRadius, pmass, life);
                p.Position = cent + (float)MathUtils.Rand.NextDouble() * blastRad * MathUtils.RandDirection();
                p.Rotation = (float)(MathUtils.Rand.NextDouble() * 2 * Math.PI);
                p.AngularVelocity = (float)(2 * maxangspd * MathUtils.Rand.NextDouble() - maxangspd);
                Particles.Add(p);
            }
        }
Esempio n. 3
0
 float alpha(Particle p)
 {
     var l = p.Lifetime / p.MaxLifetime;
     var a =  4*l * (1 - l);
     if (a < 0) a = 0;
     if (a > 1) a = 1;
     return a;
 }