Example #1
0
        /// <summary>
        /// Try and damage our victims with our stats
        /// </summary>
        /// <param name="victimsToCollideWith"></param>
        protected virtual void HitCheck(Victim groundObject)
        {
            if (groundObject.state == State.Ground)
            {
                float diameter = 0.0f;
                if (bounds.Width > bounds.Height)
                {
                    diameter = bounds.Width;
                }
                else
                {
                    diameter = bounds.Height;
                }

                Rectangle2D collideBox = new Rectangle2D(this.bounds.Center.X - (diameter / 2.0f), this.bounds.Center.Y - (diameter / 2.0f), diameter, diameter);

                switch (state)
                {
                    case State.Flying:
                        if (collideBox.Rectangle.Intersects(groundObject.bounds.Rectangle)) //we need to add damage
                        {
                            SoundEffectEngine.Play(soundHit,SoundEffectEngine.Priority.Normal);

                            float damageDone = getDamage(groundObject);

                            float resdamage = groundObject.RecieveHit(damageDone, this.tornado);

                            if (resdamage > 0)
                            {
                                this.TornadoHealth = 0; //If we can't kill the ground
                            }

                            if (this.TornadoHealth <= 0)
                            {
                                state = State.Exploding;
                            }
                        }
                        break;
                }
            }
        }
Example #2
0
        protected virtual float getDamage(Victim target)
        {
            float damage = (mass/target.Mass) * tornado.DamageFactor * this.TornadoHealth;

            // ensure a minimum amount of damage is done
            //if (damage < mass)
            //    damage = mass;

            // limit damage
            if (damage > TornadoHealth)
                damage = TornadoHealth;

            return damage;
        }
Example #3
0
 //Remove a victim from this megatile
 public void RemoveVictim(Victim remVictim)
 {
     victims.Remove(remVictim);
 }
Example #4
0
        public static bool CanDrawVictim(Level level, Victim victim)
        {
            float initalScale = 10000f;

            if (victim.Bounds.Width + victim.Bounds.Height > (level.ScreenBounds.Width + level.ScreenBounds.Height) / 120f)
            {
                return true;
            }
            else
            {
                if (level.ScreenBounds.Width + level.ScreenBounds.Height < initalScale)
                {
                    return true;
                }
                if (victim.VictimID % 2 == 0 && (level.ScreenBounds.Width + level.ScreenBounds.Height < initalScale * 1.5f))
                {
                    return true;
                }
                if (victim.VictimID % 3 == 0 && (level.ScreenBounds.Width + level.ScreenBounds.Height < initalScale * 2.0f))
                {
                    return true;
                }
                if (victim.VictimID % 4 == 0 && (level.ScreenBounds.Width + level.ScreenBounds.Height < initalScale * 2.25f))
                {
                    return true;
                }
                if (victim.VictimID % 5 == 0 && (level.ScreenBounds.Width + level.ScreenBounds.Height < initalScale * 2.5f))
                {
                    return true;
                }
            }

            return false;
        }
Example #5
0
        public void AddVictim(Victim victim)
        {
            NewVictims.Add(victim);

            NewMass = NewMass + victim.Mass;
        }