Пример #1
0
 public void Remove(BloodParticle bp)
 {
     Debug.Assert(bp != null, "Particle is null.");
     BloodParticleList.Remove(bp);
     EntityList.Remove(bp);
     PhysicalObjectList.Remove(bp);
 }
Пример #2
0
 public void Add(BloodParticle item)
 {
     Debug.Assert(item != null, "item is null.");
     BloodParticleList.Add(item);
     EntityList.Add(item);
     PhysicalObjectList.Add(item);
 }
Пример #3
0
 private void CreateBlood(int numberOfParticles, Vector2 position, int maxSpeed, float exitAngle, float spreadAngle)
 {
     for (int i = 0; i < numberOfParticles * (0.5 + (int)Settings.GoreLevel); i++)
     {
         if (!IsEntityLimitReached)
         {
             BloodParticle bp = new BloodParticle();
             bp.Position = position;
             bp.Scale    = new Vector2((float)rand.NextDouble());
             bp.Velocity = Utility.ToVector(MathHelper.WrapAngle(exitAngle + (float)rand.NextDouble() * spreadAngle), (float)rand.NextDouble() * maxSpeed);
             Add(bp);
         }
     }
 }
Пример #4
0
        private void CreateBodyParts(Vector2 position, int maxSpeed)
        {
            float exitAngle   = 0f;
            float spreadAngle = MathHelper.TwoPi;
            float maxRotation = 0.1f;

            foreach (Texture2D t in Sprites.BodyParts)
            {
                BloodParticle bp = new BloodParticle(t);
                bp.Position = position;
                //bp.Scale = new Vector2((float)rand.NextDouble());
                bp.Velocity = Utility.ToVector(MathHelper.WrapAngle(exitAngle + (float)rand.NextDouble() * spreadAngle), (float)rand.NextDouble() * maxSpeed);
                bp.Rotation = (float)rand.NextDouble() * maxRotation;
                Add(bp);
            }
        }
Пример #5
0
        private void CalculateBloodCollisions()
        {
            for (int i = 0; i < model.BloodParticleList.Count; i++)
            {
                BloodParticle bp = model.BloodParticleList.ElementAt(i);
                //Check blood vs terrain
                if (!model.Terrain.IsPositionInsideLevel(bp.Position))
                {
                    model.Remove(bp);
                }
                else if (!model.Terrain.IsPositionClear(bp.Position)) // hits terrain
                {
                    model.AddSpriteToTerrain((int)bp.Position.X, (int)bp.Position.Y, bp.Spritesheet, bp.Scale.X);
                    model.Remove(bp);
                }

                /*
                 * else if (CollidesWithBlackHole(bp))
                 * {
                 * model.BlackHoleHit(bp);
                 * }
                 */
            }
        }
Пример #6
0
 public void BlackHoleHit(BloodParticle bp)
 {
     Remove(bp);
 }