Exemple #1
0
            public Emitter(IModifier[] modifiers)
            {
                _modifiers = modifiers;

                for (var x = 0; x < Program.ParticleCount; x++)
                {
                    Particles.GetFloatValues("TimeAlive")[x]                   = 0;
                    Particles.GetFloatValues("RotationInRadians")[x]           = 1;
                    Particles.GetVector2Values("Position")[x]                  = new Vector2(100, 100);
                    Particles.GetVector2Values("ReferencePosition")[x]         = new Vector2(100, 100);
                    Particles.GetFloatValues("RotationalVelocityInRadians")[x] = 1f;
                    Particles.GetFloatValues("CurrentRed")[x]                  = 255;
                    Particles.GetFloatValues("CurrentGreen")[x]                = 255;
                    Particles.GetFloatValues("CurrentBlue")[x]                 = 255;
                    Particles.GetFloatValues("CurrentAlpha")[x]                = 255;
                    Particles.GetVector2Values("Size")[x]             = Vector2.Zero;
                    Particles.GetVector2Values("InitialSize")[x]      = new Vector2(32, 32);
                    Particles.GetVector2Values("Velocity")[x]         = new Vector2(100, 100);
                    Particles.GetByteValues("TextureSectionIndex")[x] = 0;
                    Particles.GetByteValues("InitialAlpha")[x]        = 255;
                    Particles.GetByteValues("InitialBlue")[x]         = 255;
                    Particles.GetByteValues("InitialGreen")[x]        = 255;
                    Particles.GetByteValues("InitialRed")[x]          = 255;
                    Particles.GetFloatValues("Altitude")[x]           = 0;
                    Particles.GetFloatValues("AltitudeVelocity")[x]   = 0;
                    Particles.GetIntValues("AltitudeBounceCount")[x]  = 0;
                }
            }
Exemple #2
0
            public void Modify(float timeSinceLastFrame, ParticleCollection particles)
            {
                var textureSectionIndex = particles.GetByteValues("TextureSectionIndex");
                var timeAlive           = particles.GetFloatValues("TimeAlive");

                for (var x = 0; x < Program.ParticleCount; x++)
                {
                    textureSectionIndex[x] = (byte)((timeAlive[x] / Emitter.MaxParticleLifeTime) * 10);
                }
            }
Exemple #3
0
            public void Modify(float timeSinceLastFrame, ParticleCollection particles)
            {
                var currentRed   = particles.GetFloatValues("CurrentRed");
                var currentGreen = particles.GetFloatValues("CurrentGreen");
                var currentBlue  = particles.GetFloatValues("CurrentBlue");
                var currentAlpha = particles.GetFloatValues("CurrentAlpha");
                var initialRed   = particles.GetByteValues("InitialRed");
                var initialGreen = particles.GetByteValues("InitialGreen");
                var initialBlue  = particles.GetByteValues("InitialBlue");
                var initialAlpha = particles.GetByteValues("InitialAlpha");

                for (var x = 0; x < Program.ParticleCount; x++)
                {
                    currentRed[x] -= (((initialRed[x] - Emitter.EndValue) / Emitter.MaxParticleLifeTime) *
                                      timeSinceLastFrame);
                    currentGreen[x] -= (((initialGreen[x] - Emitter.EndValue) / Emitter.MaxParticleLifeTime) *
                                        timeSinceLastFrame);
                    currentBlue[x] -= (((initialBlue[x] - Emitter.EndValue) / Emitter.MaxParticleLifeTime) *
                                       timeSinceLastFrame);
                    currentAlpha[x] -= (((initialAlpha[x] - Emitter.EndValue) / Emitter.MaxParticleLifeTime) *
                                        timeSinceLastFrame);
                }
            }