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