Exemple #1
0
        private static void CreateForceCollapseParticleEffect(int numberOfParticles, Vector2 initialPosition, float angleTrajectory)
        {
            List <SpecialEffect> pList        = new List <SpecialEffect>();
            List <Flipbook>      flipbookList = BuildForceParticle(numberOfParticles);

            for (int i = 0; i < flipbookList.Count; i++)
            {
                float angle = (float)Parameter.Random.NextDouble() * MathHelper.TwoPi;
                flipbookList[i].Position = initialPosition;
                flipbookList[i].Rotation = angle;

                pList.Add(new Particle(flipbookList[i], new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle)), Vector2.Zero, forceParticleUpdateConfiguration));
            }

            SpecialEffectHandler.AddRange(pList);
        }
Exemple #2
0
        private static void CreateGroundCollapseParticleEffect(int numberOfParticles, Vector2 initialPosition, float angleTrajectory)
        {
            List <SpecialEffect> pList        = new List <SpecialEffect>();
            List <Flipbook>      flipbookList = BuildGroundParticle(numberOfParticles);

            float   windAngle  = LevelScene.MatchMetadata.WindAngleRadians;
            Vector2 windVector = new Vector2((float)Math.Cos(windAngle), (float)Math.Sin(windAngle)) * LevelScene.MatchMetadata.WindForce * Parameter.GroundParticleWindInfluenceFactor;

            for (int i = 0; i < flipbookList.Count; i++)
            {
                float spreadFactor  = i % Parameter.GroundParticleSpreadFactor + 1;
                float disturbance   = ((float)Parameter.Random.NextDouble() - 0.5f) * MathHelper.TwoPi / spreadFactor;
                float angularSpread = angleTrajectory + disturbance;

                flipbookList[i].Position = initialPosition;
                flipbookList[i].Rotation = angularSpread;

                pList.Add(new Particle(flipbookList[i], new Vector2((float)Math.Cos(angularSpread), (float)Math.Sin(angularSpread)), windVector, groundParticleUpdateConfiguration));
            }

            SpecialEffectHandler.AddRange(pList);
        }