コード例 #1
0
 public void UseItem(Item item)
 {
     if (item is Weapon)
     {
         equippedItems.Equip(item);
     }
 }
コード例 #2
0
        public void UnEquipItem()
        {
            //Character bob = CreateCharacter();
            //Bag b = CreateBag3();
            //Dictionary<InventorySlotId, Item> _items = new Dictionary<InventorySlotId, Item>();
            //bob.Bag.

            var   equipped = new EquippedItems();
            Armor junk     = new Armor(
                Guid.NewGuid(),
                "Leather Scraps",
                null,
                false,
                .5f,
                InventorySlotId.UNEQUIPPABLE,
                1,
                1);

            Assert.IsNull(equipped[InventorySlotId.HELMET]);

            equipped.Equip(InventorySlotId.HELMET, junk);
            Assert.AreEqual(junk, equipped[InventorySlotId.HELMET]);
            equipped.Unequip(InventorySlotId.HELMET);
            Assert.AreEqual(null, equipped[InventorySlotId.HELMET]);
        }
コード例 #3
0
 public void EquipFromBackpack(IWearable i)
 {
     EquippedItems.Equip(i, Backpack);
 }