本文整理汇总了C#中Inventory.Equip方法的典型用法代码示例。如果您正苦于以下问题:C# Inventory.Equip方法的具体用法?C# Inventory.Equip怎么用?C# Inventory.Equip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Inventory
的用法示例。
在下文中一共展示了Inventory.Equip方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanEquipItemIntoTakenSlotIfAutoUnequip
public void CanEquipItemIntoTakenSlotIfAutoUnequip()
{
var inventory = new Inventory();
var item1 = new WeightedItem { Weight = Weight.Heavy, Name = "hello1" };
var item2 = new WeightedItem { Weight = Weight.Heavy, Name = "hello2" };
inventory.Add(item1);
inventory.Add(item2);
Assert.True(inventory.Equip(item1));
Assert.Same(inventory.HeavySlotItem, item1);
Assert.True(inventory.Equip(item2));
Assert.Same(inventory.HeavySlotItem, item2);
}
示例2: CanEquipItemIntoEmptySlot
public void CanEquipItemIntoEmptySlot()
{
var inventory = new Inventory();
var item = new WeightedItem { Weight = Weight.Heavy, Name = "hello" };
inventory.Add(item);
Assert.True(inventory.Equip(item));
Assert.Same(inventory.HeavySlotItem, item);
}
示例3: CanEquipSpellBook
public void CanEquipSpellBook()
{
var inventory = new Inventory();
var spellBook = new SpellBook { Name = "hello" };
inventory.Add(spellBook);
Assert.Contains(spellBook, inventory.AllItems);
Assert.Contains(spellBook, inventory.UnequippedItems);
Assert.DoesNotContain(spellBook, inventory.EquippedItems);
Assert.Null(inventory.SpellBookItem);
inventory.Equip(spellBook);
Assert.Contains(spellBook, inventory.AllItems);
Assert.DoesNotContain(spellBook, inventory.UnequippedItems);
Assert.Contains(spellBook, inventory.EquippedItems);
Assert.Same(spellBook, inventory.SpellBookItem);
}
示例4: CanEquipArmor
public void CanEquipArmor()
{
var inventory = new Inventory();
var armor = new Armor { Name = "hello" };
inventory.Add(armor);
Assert.Contains(armor, inventory.AllItems);
Assert.Contains(armor, inventory.UnequippedItems);
Assert.DoesNotContain(armor, inventory.EquippedItems);
Assert.Null(inventory.ArmorItem);
inventory.Equip(armor);
Assert.Contains(armor, inventory.AllItems);
Assert.DoesNotContain(armor, inventory.UnequippedItems);
Assert.Contains(armor, inventory.EquippedItems);
Assert.Same(armor, inventory.ArmorItem);
}
示例5: CanNotEquipItemIntoTakenSlotIfNoAutoUnequip
public void CanNotEquipItemIntoTakenSlotIfNoAutoUnequip()
{
var inventory = new Inventory();
var item1 = new WeightedItem { Weight = Weight.Heavy, Name = "hello1" };
var item2 = new WeightedItem { Weight = Weight.Heavy, Name = "hello2" };
inventory.Add(item1);
inventory.Add(item2);
Assert.True(inventory.Equip(item1, false));
Assert.Same(inventory.HeavySlotItem, item1);
Assert.False(inventory.Equip(item2, false));
Assert.Same(inventory.HeavySlotItem, item1);
Assert.NotSame(inventory.HeavySlotItem, item2);
Assert.NotNull(inventory.HeavySlotItem);
}
示例6: CollectionBehaviourIsCorrect
public void CollectionBehaviourIsCorrect()
{
var inventory = new Inventory();
var item1 = new WeightedItem { Weight = Weight.Heavy, Name = "hello1" };
var item2 = new WeightedItem { Weight = Weight.Heavy, Name = "hello2" };
inventory.Add(item1);
inventory.Add(item2);
Assert.Contains(item1, inventory.AllItems);
Assert.Contains(item2, inventory.AllItems);
Assert.Contains(item1, inventory.UnequippedItems);
Assert.Contains(item2, inventory.UnequippedItems);
Assert.DoesNotContain(item1, inventory.EquippedItems);
Assert.DoesNotContain(item2, inventory.EquippedItems);
Assert.True(inventory.Equip(item1));
Assert.DoesNotContain(item1, inventory.UnequippedItems);
Assert.Contains(item2, inventory.UnequippedItems);
Assert.Contains(item1, inventory.EquippedItems);
Assert.DoesNotContain(item2, inventory.EquippedItems);
Assert.True(inventory.Equip(item2));
Assert.Contains(item1, inventory.UnequippedItems);
Assert.DoesNotContain(item2, inventory.UnequippedItems);
Assert.DoesNotContain(item1, inventory.EquippedItems);
Assert.Contains(item2, inventory.EquippedItems);
}
示例7: CanNotEquipNonWeightedItem
public void CanNotEquipNonWeightedItem()
{
var inventory = new Inventory();
var item = new Item { Name = "hello" };
inventory.Add(item);
Assert.False(inventory.Equip(item));
}
示例8: CanNotEquipItemNotInInventory
public void CanNotEquipItemNotInInventory()
{
var inventory = new Inventory();
var item = new WeightedItem { Weight = Weight.Heavy, Name = "hello" };
Assert.False(inventory.Equip(item));
inventory.Add(item);
Assert.True(inventory.Equip(item));
}