protected override void InitializeParticle(Particle p, Vector2 where)
        {
            base.InitializeParticle(p, where);

            // the base is mostly good, but we want to simulate a little bit of wind
            // heading to the right.
            p.Acceleration.X += MoteurParticule.RandomBetween(10, 50);
        }
        protected override void InitializeParticle(Particle p, Vector2 where, Heros heros)
        {
            base.InitializeParticle(p, where, heros);

            p.Acceleration = -p.Velocity / p.Lifetime;
        }
Esempio n. 3
0
        protected virtual void InitializeParticle(Particle p, Vector2 where)
        {
            // first, call PickRandomDirection to figure out which way the particle
            // will be moving. velocity and acceleration's values will come from this.

            Vector2 direction;
            float angle = MoteurParticule.RandomBetween(0, MathHelper.TwoPi);
            direction = new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle));

            // pick some random values for our particle
            float velocity =
                MoteurParticule.RandomBetween(minInitialSpeed, maxInitialSpeed);
            float acceleration =
                MoteurParticule.RandomBetween(minAcceleration, maxAcceleration);
            float lifetime =
                MoteurParticule.RandomBetween(minLifetime, maxLifetime);
            float scale =
                MoteurParticule.RandomBetween(minScale, maxScale);
            float rotationSpeed =
                MoteurParticule.RandomBetween(minRotationSpeed, maxRotationSpeed);

            // then initialize it with those random values. initialize will save those,
            // and make sure it is marked as active.
            p.Initialize(
                where, velocity * direction, acceleration * direction,
                lifetime, scale, rotationSpeed);
        }
Esempio n. 4
0
        // surcharge
        protected virtual void InitializeParticle(Particle p, Vector2 where, Statue statue)
        {
            // first, call PickRandomDirection to figure out which way the particle
            // will be moving. velocity and acceleration's values will come from this.
            Vector2 direction;
            if (statue.SourceRectangle.Value.Y == 357)
                direction = new Vector2(0, -1);
            else if (statue.SourceRectangle.Value.Y == 0)
                direction = new Vector2(0, 1);
            else if (statue.SourceRectangle.Value.Y == 123)
                direction = new Vector2(-1, 0);
            else
                direction = new Vector2(1, 0);

            // pick some random values for our particle
            float velocity =
                MoteurParticule.RandomBetween(minInitialSpeed, maxInitialSpeed);
            float acceleration =
                MoteurParticule.RandomBetween(minAcceleration, maxAcceleration);
            float lifetime =
                MoteurParticule.RandomBetween(minLifetime, maxLifetime);
            float scale =
                MoteurParticule.RandomBetween(minScale, maxScale);
            float rotationSpeed =
                MoteurParticule.RandomBetween(minRotationSpeed, maxRotationSpeed);

            // then initialize it with those random values. initialize will save those,
            // and make sure it is marked as active.
            p.Initialize(
                where, velocity * direction, acceleration * direction,
                lifetime, scale, rotationSpeed);
        }
Esempio n. 5
0
        public override void Initialize()
        {
            InitializeConstants();

            particles = new Particle[howManyEffects * maxNumParticles];
            freeParticles = new List<Particle>(howManyEffects * maxNumParticles);
            for (int i = 0; i < particles.Length; i++)
            {
                particles[i] = new Particle();
                freeParticles.Add(particles[i]);
            }
            base.Initialize();
        }