当前位置: 首页>>代码示例>>C#>>正文


C# Inventory.Equip方法代码示例

本文整理汇总了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);
 }
开发者ID:TreeSeed,项目名称:Tychaia,代码行数:12,代码来源:InventoryTests.cs

示例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);
 }
开发者ID:TreeSeed,项目名称:Tychaia,代码行数:8,代码来源:InventoryTests.cs

示例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);
 }
开发者ID:TreeSeed,项目名称:Tychaia,代码行数:15,代码来源:InventoryTests.cs

示例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);
 }
开发者ID:TreeSeed,项目名称:Tychaia,代码行数:15,代码来源:InventoryTests.cs

示例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);
 }
开发者ID:TreeSeed,项目名称:Tychaia,代码行数:14,代码来源:InventoryTests.cs

示例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);
 }
开发者ID:TreeSeed,项目名称:Tychaia,代码行数:24,代码来源:InventoryTests.cs

示例7: CanNotEquipNonWeightedItem

 public void CanNotEquipNonWeightedItem()
 {
     var inventory = new Inventory();
     var item = new Item { Name = "hello" };
     inventory.Add(item);
     Assert.False(inventory.Equip(item));
 }
开发者ID:TreeSeed,项目名称:Tychaia,代码行数:7,代码来源:InventoryTests.cs

示例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));
 }
开发者ID:TreeSeed,项目名称:Tychaia,代码行数:8,代码来源:InventoryTests.cs


注:本文中的Inventory.Equip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。