public WeaponAmmoTuple(WeaponDefinition weapon, int ammo) { this.weapon = weapon; this.ammo = ammo; }
public static void GiveWeapon(WeaponDefinition weapon, int ammo) { player.model.pickupWeapon.Try(new WeaponAmmoTuple(weapon, ammo)); }
/// <summary> /// Condition for <see cref="EntityModel.dropWeapon"/> /// </summary> /// <param name="weaponDefinition">The weapon definition to drop.</param> /// <returns>Whether or not the weapon can be dropped.</returns> public virtual bool CanDropWeapon(WeaponDefinition weaponDefinition) { return(this.inventory.ContainsKey(weaponDefinition)); }
protected virtual bool CanSelectWeapon(WeaponDefinition def) { var weapon = GetWeaponInstance(def); return(weapon != null); }
/// <summary> /// Called when the specified weapon needs to be created. /// Usually fired when the weapon was picked up. /// </summary> protected abstract bool _CreateWeapon(WeaponDefinition definition, out Weapon weaponInstance);
/// <summary> /// Returns the weapon instance held for the specified definition. /// Will return null if there is no weapon held for the specified definition. /// </summary> protected virtual Weapon GetWeaponInstance(WeaponDefinition def) { return(weapons.Where((w) => w.weaponDefinition == def).FirstOrDefault()); }