protected override void init(Ammunition ammo)
 {
     if (ammo == null)
     {
         _ammo = new Ammunition556mm();
     }
     _coolDown = BASE_COOLDOWN * 0.2f;
 }
示例#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();
 }
示例#6
0
 /// <summary>
 /// Initializes the weapon.
 /// </summary>
 /// <param name="ammo"></param>
 protected abstract void init(Ammunition ammo);
示例#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" );
                }
            }
        }
示例#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);
 }
示例#9
0
 /// <summary>
 /// Removes the bullet from the model.
 /// </summary>
 /// <param name="bullet"></param>
 public void Remove(Ammunition bullet)
 {
     _bullets.Remove(bullet);
 }
示例#10
0
 /// <summary>
 /// Adds the bullet to the model.
 /// </summary>
 /// <param name="bullet"></param>
 public void Add(Ammunition bullet)
 {
     _bullets.Add(bullet);
 }
示例#11
0
 /// <summary>
 /// Adds the bullet to the model.
 /// </summary>
 /// <param name="bullet"></param>
 public void Add( Ammunition bullet )
 {
     _bullets.Add( bullet );
 }
示例#12
0
 /// <summary>
 /// Removes the bullet from the model.
 /// </summary>
 /// <param name="bullet"></param>
 public void Remove( Ammunition bullet )
 {
     _bullets.Remove( bullet );
 }