Exemple #1
0
 public void Add(Vector2 spawnPos, Vector2 velocity, double attackTime, double lifeTime, double decayTime, bool affectedbygravity, bool canCollide, Rectangle sourcerect, Color col, Action<Particle> particleFunc, float startScale, float startRot, float rotSpeed, int depth, ParticleBlend blend)
 {
     Particle p = Particles.FirstOrDefault(part => part.State == ParticleState.Done);
     if (p != null)
     {
         p.Position = spawnPos;
         p.Velocity = velocity;
         p.Blend = blend;
         p.Depth = depth;
         p.AttackTime = attackTime;
         p.LifeTime = lifeTime;
         p.DecayTime = decayTime;
         p.AttackValue = 0f;
         p.LifeValue = 0f;
         p.DecayValue = 0f;
         p.AffectedByGravity = affectedbygravity;
         p.CanCollide = canCollide;
         p.SourceRect = sourcerect;
         p.Alpha = 1f;
         p.State = ParticleState.Attack;
         p.Scale = startScale;
         p.Rotation = startRot;
         p.RotationSpeed = rotSpeed;
         p.Color = col;
         p.ParticleFunction = particleFunc;
         p.ParticleFunction(p);
     }
 }
Exemple #2
0
        public void Add(Vector2 spawnPos, Vector2 velocity, double attackTime, double lifeTime, double decayTime, bool affectedbygravity, bool canCollide, Rectangle sourcerect, Color col, Action <Particle> particleFunc, float startScale, float startRot, float rotSpeed, int depth, ParticleBlend blend)
        {
            Particle p = Particles.FirstOrDefault(part => part.State == ParticleState.Done);

            if (p != null)
            {
                p.Position          = spawnPos;
                p.Velocity          = velocity;
                p.Blend             = blend;
                p.Depth             = depth;
                p.AttackTime        = attackTime;
                p.LifeTime          = lifeTime;
                p.DecayTime         = decayTime;
                p.AttackValue       = 0f;
                p.LifeValue         = 0f;
                p.DecayValue        = 0f;
                p.AffectedByGravity = affectedbygravity;
                p.CanCollide        = canCollide;
                p.SourceRect        = sourcerect;
                p.Alpha             = 1f;
                p.State             = ParticleState.Attack;
                p.Scale             = startScale;
                p.Rotation          = startRot;
                p.RotationSpeed     = rotSpeed;
                p.Color             = col;
                p.ParticleFunction  = particleFunc;
                p.ParticleFunction(p);
            }
        }