protected override void init(Ammunition ammo)
 {
     if (ammo == null)
     {
         _ammo = new Ammunition556mm();
     }
     _coolDown = BASE_COOLDOWN * 0.2f;
 }
Example #2
0
        /// <summary>
        /// Deals damage to the entity according to the bullet
        /// that has hit it.
        /// </summary>
        /// <param name="bullet"></param>
        public void DealDamage(Ammunition bullet)
        {
            if (IsAlive)
            {
                Game1._soundBank.PlayCue("hurt_enemy0");
                _currentHealth -= bullet.damage;
                IsAlive         = _currentHealth > 0;

                // The entity was killed, replace the sprite to that of a corpse
                if (!IsAlive)
                {
                    Game1._soundBank.PlayCue("killed_enemy0");
                    _sprite = SpriteManager.CreateSprite(Position, "enemy-dead");
                }
            }
        }
 protected override void init( Ammunition ammo )
 {
     _coolDown = BASE_COOLDOWN;
     _ammo = new AmmunitionPiercing();
 }
 protected override void init( Ammunition ammo )
 {
     if( ammo == null )
         _ammo = new Ammunition556mm();
     _coolDown = BASE_COOLDOWN * 0.2f;
 }
 protected override void init(Ammunition ammo)
 {
     _coolDown = BASE_COOLDOWN;
     _ammo     = new AmmunitionPiercing();
 }
Example #6
0
 /// <summary>
 /// Initializes the weapon.
 /// </summary>
 /// <param name="ammo"></param>
 protected abstract void init(Ammunition ammo);
Example #7
0
        /// <summary>
        /// Deals damage to the entity according to the bullet
        /// that has hit it.
        /// </summary>
        /// <param name="bullet"></param>
        public void DealDamage( Ammunition bullet )
        {
            if( IsAlive )
            {
                Game1._soundBank.PlayCue( "hurt_enemy0" );
                _currentHealth -= bullet.damage;
                IsAlive = _currentHealth > 0;

                // The entity was killed, replace the sprite to that of a corpse
                if( !IsAlive )
                {
                    Game1._soundBank.PlayCue( "killed_enemy0" );
                    _sprite = SpriteManager.CreateSprite( Position, "enemy-dead" );
                }
            }
        }
Example #8
0
 /// <summary>
 /// Creates a new weapon with the given ammunition.
 /// </summary>
 /// <param name="spriteManager"></param>
 /// <param name="ammo"></param>
 public Weapon(Ammunition ammo)
 {
     _ammo = ammo;
     init(ammo);
 }
Example #9
0
 /// <summary>
 /// Removes the bullet from the model.
 /// </summary>
 /// <param name="bullet"></param>
 public void Remove(Ammunition bullet)
 {
     _bullets.Remove(bullet);
 }
Example #10
0
 /// <summary>
 /// Adds the bullet to the model.
 /// </summary>
 /// <param name="bullet"></param>
 public void Add(Ammunition bullet)
 {
     _bullets.Add(bullet);
 }
Example #11
0
 /// <summary>
 /// Adds the bullet to the model.
 /// </summary>
 /// <param name="bullet"></param>
 public void Add( Ammunition bullet )
 {
     _bullets.Add( bullet );
 }
Example #12
0
 /// <summary>
 /// Removes the bullet from the model.
 /// </summary>
 /// <param name="bullet"></param>
 public void Remove( Ammunition bullet )
 {
     _bullets.Remove( bullet );
 }