Exemplo n.º 1
0
        //public static SpriteParticleEffect GetParticleEffect(string id, Vector2 initialPosition, ISpriteDetails spriteDetails)
        //{
        //    var qualifiedName = Qualifier + id;
        //    var particleEffect = (SpriteParticleEffect)Activator.CreateInstance(Type.GetType(qualifiedName), initialPosition, spriteDetails);
        //    particleEffect.Initialize();
        //    return particleEffect;
        //}

        public static IInterfaceParticleEffect GetInterfaceParticleEffect(string id, ParticleDensity particleDensity, Color color)
        {
            var qualifiedName  = Qualifier + id;
            var particleEffect = (IInterfaceParticleEffect)Activator.CreateInstance(Type.GetType(qualifiedName), particleDensity, color);

            return(particleEffect);
        }
Exemplo n.º 2
0
Arquivo: Snow.cs Projeto: phobon/abyss
 /// <summary>
 /// Initializes a new instance of the <see cref="Snow"/> class.
 /// </summary>
 /// <param name="particleDensity">The particle density.</param>
 /// <param name="color">The color.</param>
 public Snow(ParticleDensity particleDensity, Color color)
     : base(
         "Snow",
         "Snow particle effect",
         particleDensity)
 {
     this.Color = color;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Speck"/> class.
 /// </summary>
 /// <param name="maximumDepth">The maximum depth.</param>
 /// <param name="particleDensity">The particle density.</param>
 /// <param name="color">The color.</param>
 public Speck(ParticleDensity particleDensity, Color color)
     : base(
         "Speck",
         "Speck particle effect",
         particleDensity)
 {
     this.Color = color;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Aura"/> class.
 /// </summary>
 /// <param name="particleDensity">The particle density.</param>
 /// <param name="color">The color.</param>
 public Aura(ParticleDensity particleDensity, Color color)
     : base(
         "Aura",
         "Aura particle effect",
         particleDensity)
 {
     this.Color      = color;
     this.velocities = new Dictionary <Direction, IList <Vector2> >
     {
         { Direction.Left, new List <Vector2>() },
         { Direction.Right, new List <Vector2>() }
     };
 }
Exemplo n.º 5
0
        void InitializeComputeBuffers()
        {
            Particle[] particles = new Particle[maxParticles];
            for (int i = 0; i < maxParticles; i++)
            {
                float x = EmitPosition.x + ParticleInitGap + ParticleInitGap * (i % 128);
                float y = EmitPosition.y + ParticleInitGap + ParticleInitGap * (i / 128);
                particles[i].Position = new Vector2(x, y);
            }

            ParticleForce[]   particlesForce   = new ParticleForce[maxParticles];
            ParticleDensity[] particlesDensity = new ParticleDensity[maxParticles];

            SPHParticlesRead    = new ComputeBuffer(maxParticles, Marshal.SizeOf(typeof(Particle)));
            SPHParticlesWrite   = new ComputeBuffer(maxParticles, Marshal.SizeOf(typeof(Particle)));
            SPHParticlesForce   = new ComputeBuffer(maxParticles, Marshal.SizeOf(typeof(ParticleForce)));
            SPHParticlesDensity = new ComputeBuffer(maxParticles, Marshal.SizeOf(typeof(ParticleDensity)));

            SPHParticlesRead.SetData(particles);
            SPHParticlesWrite.SetData(particles);
            SPHParticlesForce.SetData(particlesForce);
            SPHParticlesDensity.SetData(particlesDensity);
        }
Exemplo n.º 6
0
        public static IFullScreenParticleEffect GetFullScreenParticleEffect(string id, ParticleDensity particleDensity, Color color)
        {
            var qualifiedName  = Qualifier + id;
            var particleEffect = (IFullScreenParticleEffect)Activator.CreateInstance(Type.GetType(qualifiedName), particleDensity, color);

            particleEffect.Initialize();
            return(particleEffect);
        }
Exemplo n.º 7
0
        public static IFullScreenParticleEffect GetFullScreenParticleEffect(ZoneType zoneType, ParticleDensity particleDensity)
        {
            var effects = fullscreenParticleEffectsByZone[zoneType];

            if (effects.Count == 0)
            {
                return(null);
            }

            var qualifiedName = effects[MathsHelper.Random(effects.Count)];

            // Get a random color.
            var colors = fullscreenParticleEffectColors[qualifiedName];
            var color  = colors[MathsHelper.Random(colors.Count)];

            var particleEffect = (IFullScreenParticleEffect)Activator.CreateInstance(Type.GetType(qualifiedName), particleDensity, color);

            particleEffect.Initialize();
            return(particleEffect);
        }