public static Item GetAmmo(Weapon.AmmoType type, Vector2 position) { switch (type) { case Weapon.AmmoType.Light: return(new Item(ligthAmmo, position)); case Weapon.AmmoType.Medium: return(new Item(mediumAmmo, position)); case Weapon.AmmoType.Heavy: return(new Item(heavyAmmo, position)); case Weapon.AmmoType.Nails: return(new Item(nailAmmo, position)); default: goto case Weapon.AmmoType.Light; // keep all the bases covered ( ͡° ͜ʖ ͡°) } }
public bool AddAmmo(Weapon.AmmoType type, int amount) { Weapon tmp = null; for (int i = 0; i < weapons.Length; i++) { if (weapons[i].ammotype == type) { tmp = weapons[i]; i = weapons.Length; } } if (tmp != null) { return(tmp.AddAmmo(amount)); } else { return(false); } }
public ItemProperties(byte width, byte height, float weight, Texture2D texture, byte maxStack, string infoText, Weapon.AmmoType ammoType) : this(width, height, weight, texture, maxStack, infoText, null, null, ammoType, null) { }