• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Armor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Armor的典型用法代码示例。如果您正苦于以下问题:C# Armor类的具体用法?C# Armor怎么用?C# Armor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Armor类属于命名空间,在下文中一共展示了Armor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AddArmor

 public void AddArmor(string id)
 {
     Armor x = new Armor();
     x.ID = id;
     x.Description = "An Armor Set";
     Armors.Add(x);
 }
开发者ID:charblaze,项目名称:SoulSynthusResonance,代码行数:7,代码来源:PlayerInventory.cs


示例2: Armor

 public Armor(Armor armor)
     : base(armor)
 {
     this.armorValue = armor.ArmorValue;
     this.exterieur = armor.exterieur;
     this.interieur = armor.interieur;
 }
开发者ID:JMounier,项目名称:Aegina,代码行数:7,代码来源:Armor.cs


示例3: ArmorEqualsAndHashCode

        public void ArmorEqualsAndHashCode()
        {
            Armor armor = new Armor(ArmorType.Unarmored, 5);

            //Using IsTrue/IsFalse to cover all paths (aren't covered, when using Equals)
            //Equal tests
            Assert.IsTrue(armor.Equals(armor));
            Assert.AreEqual(armor.GetHashCode(), armor.GetHashCode());

            object equal = new Armor(ArmorType.Unarmored, 5);
            Assert.IsTrue(armor.Equals(equal));
            Assert.AreEqual(equal.GetHashCode(), armor.GetHashCode());

            //Not equal tests
            Assert.IsFalse(armor.Equals(null));

            object notEqual = new object();
            Assert.IsFalse(armor.Equals(notEqual));
            Assert.AreNotEqual(notEqual.GetHashCode(), armor.GetHashCode());

            notEqual = new Armor(ArmorType.Medium, 5);
            Assert.IsFalse(armor.Equals(notEqual));
            Assert.AreNotEqual(notEqual.GetHashCode(), armor.GetHashCode());

            notEqual = new Armor(ArmorType.Unarmored, 3);
            Assert.IsFalse(armor.Equals(notEqual));
            Assert.AreNotEqual(notEqual.GetHashCode(), armor.GetHashCode());
        }
开发者ID:JonasGoldt,项目名称:TDGD_TD,代码行数:28,代码来源:TestArmor.cs


示例4: changeArmor

 void changeArmor(Armor armor)
 {
     if(armorSwitcher != null){
         armorSwitcher.changeAnimationLayer(armor.armorAnimationLayerName);
         armorSwitcher.switchArm(armor.armSprite);
     }
 }
开发者ID:krylorz,项目名称:New-Space-Scavs-Repo,代码行数:7,代码来源:ArmorSlot.cs


示例5: CreateHat

    private static Armor CreateHat()
    {
        Armor armor = new Armor();

        string[] hatNames = new string[] {
            "Small Hat",
            "Mid Hat",
            "Large Hat"
                                            };

        //fill in all of the values for that item type
        armor.Name = hatNames[Random.Range(0, hatNames.Length)];

        //assign properties for the item
        armor.ArmorLevel = Random.Range(10, 50);

        //assign the icon for the weapon
        armor.Icon = Resources.Load(GameSetting2.HAT_ICON_PATH + armor.Name) as Texture2D;

        //assign the eqipment slot where this can be assigned
        armor.Slot = EquipmentSlot.Head;

        //return the melee weapon
        return armor;
    }
开发者ID:ricoswx,项目名称:CS4213_Project,代码行数:25,代码来源:ItemGenerator.cs


示例6: HeavyArmorDamageRecalculation

        public void HeavyArmorDamageRecalculation()
        {
            //Test with an amount of 0
            Armor heavy = new Armor(ArmorType.Heavy, 0);

            Assert.AreEqual(80, heavy.RecalculateDamage(Pierce));
            Assert.AreEqual(120, heavy.RecalculateDamage(Siege));
            Assert.AreEqual(90, heavy.RecalculateDamage(Magic));
            Assert.AreEqual(100, heavy.RecalculateDamage(Chaos));

            //Test with an amount of 10
            heavy = new Armor(ArmorType.Heavy, 10);

            Assert.AreEqual(64, heavy.RecalculateDamage(Pierce));
            Assert.AreEqual(111, heavy.RecalculateDamage(Siege));
            Assert.AreEqual(85, heavy.RecalculateDamage(Magic));
            Assert.AreEqual(93, heavy.RecalculateDamage(Chaos));

            //Test with a high amount
            heavy = new Armor(ArmorType.Heavy, 10000);

            Assert.IsTrue(heavy.RecalculateDamage(Pierce) > 0);
            Assert.IsTrue(heavy.RecalculateDamage(Siege) > 0);
            Assert.IsTrue(heavy.RecalculateDamage(Magic) > 0);
            Assert.IsTrue(heavy.RecalculateDamage(Chaos) > 0);
        }
开发者ID:JonasGoldt,项目名称:TDGD_TD,代码行数:26,代码来源:TestArmor.cs


示例7: Armor

 public Armor(Armor armor)
 {
     this.name = armor.name;
     this.type = armor.type;
     this.value = armor.value;
     this.armortype = armor.armortype;
     this.trait = armor.trait;
 }
开发者ID:kevinwegner,项目名称:ConsoleDungeonCrawler,代码行数:8,代码来源:Armor.cs


示例8: EquipArmor

 /// <summary>
 /// 穿上護甲
 /// </summary>
 void EquipArmor(Armor _armor)
 {
     //穿上裝備,如果返回false代表無法裝備
     if (!_armor.Equip())
         return;
     Equip(_armor, true);//穿上裝備
     AddArmorBuffer(_armor.BufferID);
 }
开发者ID:scozirge,项目名称:AVentureCapital,代码行数:11,代码来源:Equip.cs


示例9: takeArmor

 public void takeArmor(Armor someArmor)
 {
     if ( someArmor.Owner != null ) {
         throw new ArgumentException();
     }
     ownArmor = someArmor;
     ownArmor.Owner = this;
 }
开发者ID:MalxMalx,项目名称:Unit-2,代码行数:8,代码来源:Unit.cs


示例10: UpdateBonuses

	public void UpdateBonuses(Armor a, Weapon w) {
		if (a != null) {
			armorbonus = a.armorBonus;
		}
		if (w != null) {
			attackbonus = w.damageBonus;
			speedbonus = w.speedBonus;
		}
	}
开发者ID:NotYours180,项目名称:Survival,代码行数:9,代码来源:Status.cs


示例11: Clone

        public object Clone()
        {
            Armor armor = new Armor();

            armor.DmgBlock = this.DmgBlock;
            armor.Name = this.Name;

            return armor;
        }
开发者ID:elefantstudio-se,项目名称:ElefantStudio-Prototyp-Exempel,代码行数:9,代码来源:Armor.cs


示例12: AddItem

    public void AddItem(Item pItem)
    {
        pItems.Add(pItem);

        if (pItem.ItmType == Item.ItemType.Weapon && pEquipedWeapon == null)
            pEquipedWeapon = pItem as Weapon;
        else if (pItem.ItmType == Item.ItemType.Armor && pEquipedArmor == null)
            pEquipedArmor = pItem as Armor;
    }
开发者ID:Thex-PiedDroit,项目名称:Secret_of_Mana_Recreate,代码行数:9,代码来源:Inventory.cs


示例13: addArmor

 public bool addArmor(Armor a)
 {
     if(a.getWeight() + weight > weightLimit) {
         return false;
     } else {
         armors.Add(a);
         weight += a.getWeight();
         return true;
     }
 }
开发者ID:TheAlchemistStudio,项目名称:DnD,代码行数:10,代码来源:Inventory.cs


示例14: Unit

 public Unit(string name = defaultName, double health = defaultHealth)
 {
     if ( health < 10 || health > 100 ) {
         throw new ArgumentException();
     }
     this.name = name;
     this.health = health;
     ownWeapon = NoWeapon;
     ownArmor = NoArmor;
 }
开发者ID:MalxMalx,项目名称:Unit-2,代码行数:10,代码来源:Unit.cs


示例15: removeArmor

 public void removeArmor()
 {
     if(isPrimarySlotOccupied()){
         primaryarmor.transform.parent = null;
         primaryarmor.disableAbility();
         primaryarmor.enableSprite();
         primaryarmor.drop(owner.getCollider());
         defaultArmor();
         primaryarmor = null;
     }
 }
开发者ID:krylorz,项目名称:New-Space-Scavs-Repo,代码行数:11,代码来源:ArmorSlot.cs


示例16: DataToXML

        // Write program entries TO XML-file
        private static void DataToXML(Armor[] armorArr)
        {
            XmlSerializer serializerFromData = new XmlSerializer(armorArr.GetType());

            TextWriter writerToFile = new StreamWriter("..\\..\\ArmorSerialization\\Armor.xml");

            serializerFromData.Serialize(writerToFile, armorArr);

            // Close the writerToFile [StreamWriter]
            writerToFile.Close();
        }
开发者ID:Tayum,项目名称:di0d,代码行数:12,代码来源:Program.cs


示例17: ArmorTest

        public void ArmorTest()
        {
            // Create a new Human character.
            Character objCharacter = new Character();
            objCharacter.LoadMetatype(Guid.Parse("e28e7075-f635-4c02-937c-e4fc61c51602"));

            // Add ArmorValue 6 Armor to the character. Their total Armor should be 6 with a Encumbrance penalty of 0 since there is nothing with a +value.
            Armor objArmor = new Armor(objCharacter);
            objArmor.ArmorValue = "6";
            objCharacter.Armor.Add(objArmor);

            Assert.AreEqual(6, objCharacter.ArmorValue, "ArmorValue does not equal the expected value of 6.");
            Assert.AreEqual(6, objCharacter.TotalArmorValue, "TotalArmorValue does not equal the expected value of 6.");
            Assert.AreEqual(0, objCharacter.ArmorEncumbrance, "ArmorEncumbrance does not equal the expected value of 0.");

            // Add an Armor Mod to the Armor. This should bring the Armor value up to 8.
            ArmorMod objMod = new ArmorMod(objCharacter);
            objMod.ArmorValue = 2;
            objCharacter.Armor[0].ArmorMods.Add(objMod);

            Assert.AreEqual(8, objCharacter.ArmorValue, "ArmorValue does not equal the expected value of 8.");
            Assert.AreEqual(8, objCharacter.TotalArmorValue, "TotalArmorValue does not equal the expected value of 8.");
            Assert.AreEqual(0, objCharacter.ArmorEncumbrance, "ArmorEncumbrance does not equal the expected value of 0.");

            // Add an additional +6 value Armor to the character. Their total Aromr should be 14 with an Encumbrance penalty of 2.
            Armor objPlusArmor = new Armor(objCharacter);
            objPlusArmor.ArmorValue = "+6";
            objCharacter.Armor.Add(objPlusArmor);

            Assert.AreEqual(14, objCharacter.ArmorValue, "ArmorValue does not equal the expected value of 14.");
            Assert.AreEqual(14, objCharacter.TotalArmorValue, "TotalArmorValue does not equal the expected value of 14.");
            Assert.AreEqual(2, objCharacter.ArmorEncumbrance, "ArmorEncumbrance does not equal the expected value of 2.");

            // Increase the character's STR to 4. This should reduce the Armor Encumbrance penalty to 1.
            objCharacter.STR.Value = 4;

            Assert.AreEqual(14, objCharacter.ArmorValue, "ArmorValue does not equal the expected value of 14.");
            Assert.AreEqual(14, objCharacter.TotalArmorValue, "TotalArmorValue does not equal the expected value of 14.");
            Assert.AreEqual(1, objCharacter.ArmorEncumbrance, "ArmorEncumbrance does not equal the expected value of 1.");

            // Unequipping the Armor Mod should reduce the Armor value down to 12.
            objCharacter.Armor[0].ArmorMods[0].Equipped = false;

            Assert.AreEqual(12, objCharacter.ArmorValue, "ArmorValue does not equal the expected value of 12.");
            Assert.AreEqual(12, objCharacter.TotalArmorValue, "TotalArmorValue does not equal the expected value of 12.");
            Assert.AreEqual(1, objCharacter.ArmorEncumbrance, "ArmorEncumbrance does not equal the expected value of 1.");

            // Unequipping the +value Armor should put the character back to Armor 6 with no Encumbrance penalty.
            objCharacter.Armor[1].Equipped = false;

            Assert.AreEqual(6, objCharacter.ArmorValue, "ArmorValue does not equal the expected value of 6.");
            Assert.AreEqual(6, objCharacter.TotalArmorValue, "TotalArmorValue does not equal the expected value of 6.");
            Assert.AreEqual(0, objCharacter.ArmorEncumbrance, "ArmorEncumbrance does not equal the expected value of 0.");
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:54,代码来源:CharacterTests.cs


示例18: Health

        public Health(int amount, Killable owner, Armor armor)
        {
            if (amount <= 0) {
                throw new System.ArgumentException("Healthes with a negative amount aren't allowed");
            }

            MaxAmount = amount;
            Amount = amount;
            Owner = owner;
            Armor = armor;
        }
开发者ID:JonasGoldt,项目名称:TDGD_TD,代码行数:11,代码来源:Health.cs


示例19: TryParseArmorShortName

        public static bool TryParseArmorShortName(string shortName, out Armor armor)
        {
            int tmp;
            if (_armorShortCutNameToIdTable.TryGetValue(shortName, out tmp))
            {
                armor = (Armor)tmp;
                return true;
            }

            armor = Armor.Invalid;
            return false;
        }
开发者ID:mrvoorhe,项目名称:redox-extensions,代码行数:12,代码来源:Sets.cs


示例20: Clone

	public override Item Clone ()
	{
		Armor item = new Armor();
		base.CloneBase(item);

		//copy all vars before return
		item.Fits = Fits;
		item.ArmorValue = ArmorValue;
		item.DefenseValue = DefenseValue;

		return item;
	}
开发者ID:Gapti,项目名称:INT-Marks,代码行数:12,代码来源:Armor.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Array类代码示例发布时间:2022-05-24
下一篇:
C# Arguments类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap