Пример #1
0
        /// <summary>
        /// Creates a new particle
        /// </summary>
        /// <param name="position">The initial position of the particle</param>
        /// <param name="parameters1">The initial configuration of this particle</param>
        /// <param name="parameters2">The configuration this particle will take in its "second life"</param>
        public CpuParticle(DoubleVector3 position, CpuParticleParametersStruct parameters1, CpuParticleParametersStruct parameters2)
        {
            Alive    = true;
            Position = position;
            Color    = new Color4(parameters1.Color);

            Parameters1 = parameters1;
            Parameters2 = parameters2;
        }
Пример #2
0
 /// <summary>
 /// Adds a new particle
 /// </summary>
 /// <param name="position">The initial position of the particle</param>
 /// <param name="parameters1">The initial configuration of this particle</param>
 /// <param name="parameters2">The configuration this particle will take in its "second life"</param>
 private void AddParticle(DoubleVector3 position, CpuParticleParametersStruct parameters1, CpuParticleParametersStruct parameters2)
 {
     if (_deadParticles.Count > 0)
     {
         CpuParticle particle = _deadParticles.Pop();
         particle.Alive       = true;
         particle.Position    = position;
         particle.Velocity    = default(Vector3);
         particle.Parameters1 = parameters1;
         particle.Parameters2 = parameters2;
         particle.Color       = parameters1.Color;
         particle.SecondLife  = false;
         _firstLifeParticles.Add(particle);
     }
     else
     {
         _firstLifeParticles.Add(new CpuParticle(position, parameters1, parameters2));
     }
 }