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

C# IWeapon类代码示例

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

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



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

示例1: Awake

 void Awake()
 {
     weaponPool = new GameObjectPool(projectile, maximumSize, initialSize, transform);
     impactPool = new GameObjectPool(impact, -1, initialSize / 2, transform);
     WeaponManager.Register(this);
     weapon = projectile.GetComponent<IWeapon>();
 }
开发者ID:shaunvxc,项目名称:Infamy,代码行数:7,代码来源:LaserController.cs


示例2: CombatantsCreatedThruFactoryCanAttack

        public void CombatantsCreatedThruFactoryCanAttack()
        {
            // Setup our stub.
            this.stubWeapon = MockRepository.GenerateStub<IWeapon>();
            this.equipmentFactory.Stub(x => x.EquipCombatant(null)).IgnoreArguments().Do(
                new EquipCombatant(this.StubEquipCombatant));
            this.equipmentFactory.Replay();
            this.stubWeapon.Expect(x => x.CalculateDamage()).Return(10);
            this.stubWeapon.Expect(x => x.CalculateDamage()).Return(10);

            // Get our combatants.
            string knightName = "My Knight";
            var knight = combatantFactory.CreateCombatant<Knight>(knightName);
            string randomCombatantName = "My Random Combatant";
            var randomCombatant = combatantFactory.CreateRandomCombatant(randomCombatantName);

            int catapultHealth = randomCombatant.Health;
            int knightHealth = knight.Health;

            randomCombatant.Attack(knight);
            knight.Attack(randomCombatant);

            this.equipmentFactory.VerifyAllExpectations();
            this.stubWeapon.VerifyAllExpectations();
            Assert.AreNotEqual(catapultHealth, randomCombatant.Health);
            Assert.AreNotEqual(knightHealth, knight.Health);
        }
开发者ID:neraath,项目名称:YeOldeTdd,代码行数:27,代码来源:CombatantFactoryTests.cs


示例3: ChangeWeapon

 public void ChangeWeapon(IWeapon newWeapon, List<Character> selectedNames)
 {
     foreach (Character character in selectedNames)
     {
         character.weapon = newWeapon;
     }
 }
开发者ID:watset1,项目名称:IN710watset1,代码行数:7,代码来源:CharacterManager.cs


示例4: FightWithDefaultContext

 public void FightWithDefaultContext(IWeapon weapon1, IWeapon weapon2)
 {
     // Assert
       weapon1.Should().BeSameAs (weapon2);
       weapon1.Should().BeSameAs (_weapon1);
       weapon1.Should().NotBeSameAs (_weapon2);
 }
开发者ID:yln,项目名称:Nukito,代码行数:7,代码来源:ContextExample.cs


示例5: ForgedWeapon

        // These two constructors are indicative of a needed abstraction.
        public ForgedWeapon(IWeapon weapon, IMaterialComponent component)
        {
            GivenName = weapon.GivenName;
            Damage = weapon.Damage;
            CriticalDamage = weapon.CriticalDamage;
            DamageType = weapon.DamageType;
            MaxRange = weapon.MaxRange;
            Proficiency = weapon.Proficiency;
            RangeIncrement = weapon.RangeIncrement;
            ThreatRange = weapon.ThreatRange;
            ThreatRangeLowerBound = weapon.ThreatRangeLowerBound;
            WeaponCategory = weapon.WeaponCategory;
            WeaponName = string.Format("{0} {1}", component.ComponentName, weapon.WeaponName);
            WeaponSize = weapon.WeaponSize;
            WeaponSubCategory = weapon.WeaponSubCategory;
            WeaponUse = weapon.WeaponUse;
            Hardness = weapon.Hardness;
            HitPoints = weapon.HitPoints;
            IsBow = weapon.IsBow;

            Weight = component.ApplyWeightModifer(weapon);
            ToHitModifier = component.ApplyToHitModifier();
            WeaponCost = component.ApplyCostModifier(weapon);
            SpecialInfo = component.AppendSpecialInfo(weapon);
            IsMasterwork = component.VerifyMasterwork(weapon);
            DamageBonus = component.ApplyDamageModifier(weapon);
            ComponentName = component.ComponentName;
            AdditionalEnchantmentCost = component.GetAdditionalEnchantmentCost();
        }
开发者ID:willegetz,项目名称:notpk,代码行数:30,代码来源:ForgedWeapon.cs


示例6: ApplyDamage

		public void ApplyDamage(int _damage, IWeapon _weapon, Creature _source)
		{
			var fact = Math.Min(_damage, HP);

			if (!(Creature is Avatar))
			{
				HP -= _damage;
			}
			Creature.DamageTaken(this, _source, _weapon, _damage);

			fact -= Creature[0, 0].AddSplatter(fact, FColor.Crimson);
			if (fact > 0)
			{
				var ro = World.Rnd.NextDouble() * Math.PI * 2;
				var x = (int)(Math.Sin(ro) * 20f);
				var y = (int)(Math.Cos(ro) * 20f);

				new SplatterDropper(Creature.GeoInfo.Layer, Creature[0, 0], fact, FColor.Crimson, Creature[x, y]);
			}

			if (HP <= 0)
			{
				MessageManager.SendXMessage(this, new XMessage(EALTurnMessage.CREATURE_KILLED, _source, Creature));
				Creature[0, 0].AddItem(new Corpse(Creature));
				World.TheWorld.CreatureManager.CreatureIsDead(Creature);
			}
		}
开发者ID:Foxbow74,项目名称:my-busycator,代码行数:27,代码来源:CreatureBattleInfo.cs


示例7: LaserDecorator

 public LaserDecorator(IWeapon wpn)
 {
     _scale = GameLogic.GetInstance().GetScale();
     _offset = new Vector2(_scale*2.5f, -(_scale*5f));
     _speed = new Vector2(0, -(_scale*4f));
     _wpn = wpn;
 }
开发者ID:Blind238,项目名称:GameProject,代码行数:7,代码来源:LaserDecorator.cs


示例8: Awake

    protected virtual void Awake()
    {
        m_hForward = false;
        m_hBackward = false;
        m_hRight = false;
        m_hLeft = false;

        m_hWheels = new List<Wheel>();
        m_hRigidbody = this.GetComponent<Rigidbody>();
        m_hRigidbody.interpolation = RigidbodyInterpolation.None;
        //Initialize effective wheels
        List<Transform> gfxPos = this.GetComponentsInChildren<Transform>().Where(hT => hT.GetComponent<WheelCollider>() == null).ToList();
        this.GetComponentsInChildren<WheelCollider>().ToList().ForEach(hW => m_hWheels.Add(new Wheel(hW, gfxPos.OrderBy(hP => Vector3.Distance(hP.position, hW.transform.position)).First().gameObject)));
        m_hWheels = m_hWheels.OrderByDescending(hW => hW.Collider.transform.localPosition.z).ToList();

        //Initialize extra wheels
        m_hFakeWheels = GetComponentsInChildren<FakeWheel>().ToList();

        //Initialize VehicleTurret
        m_hTurret = GetComponentInChildren<VehicleTurret>();

        //Initialize IWeapon
        m_hCurrentWeapon = GetComponentInChildren<IWeapon>();

        m_hActor = GetComponent<Actor>();

        //Initialize Drive/Brake System
        switch (DriveType)
        {
            case DriveType.AWD:
                m_hEngine = new AwdDrive(Hp, m_hWheels);
                break;
            case DriveType.RWD:
                m_hEngine = new RearDrive(Hp, m_hWheels);
                break;
            case DriveType.FWD:
                m_hEngine = new ForwardDrive(Hp, m_hWheels);
                break;
            default:
                break;
        }


        m_hConstanForce = this.GetComponent<ConstantForce>();
        m_hReverseCOM = new Vector3(0.0f, -2.0f, 0.0f);

        m_hOriginalCOM = m_hRigidbody.centerOfMass;


        GroundState hGroundState = new GroundState(this);
        FlyState hFlyState = new FlyState(this);
        TurnedState hTurned = new TurnedState(this, m_hReverseCOM);

        hGroundState.Next = hFlyState;
        hFlyState.Grounded = hGroundState;
        hFlyState.Turned = hTurned;
        hTurned.Next = hFlyState;
        m_hFlyState = hFlyState;
    }
开发者ID:Alx666,项目名称:ProjectPhoenix,代码行数:59,代码来源:ControllerWheels.cs


示例9: Player

 protected Player(Position position, int health, int damage, string name, int energyPoints, Image image, IWeapon weapon, int healingPoints)
     : base(position, health, damage, image)
 {
     this.Name = name;
     this.EnergyPoints = energyPoints;
     this.Weapon = weapon;
     this.healingPoints = healingPoints;
 }
开发者ID:TeamDoldur,项目名称:RPG-Game,代码行数:8,代码来源:Player.cs


示例10: Awake

 void Awake()
 {
     this.HeliRigidBody = GetComponent<Rigidbody>();
     this.mass = HeliRigidBody.mass;
     this.isGrounded = true;
     this.playerPlane = new Plane(Vector3.up, this.transform.position);
     m_hCurrentWeapon = GetComponentInChildren<IWeapon>();
 }
开发者ID:Alx666,项目名称:ProjectPhoenix,代码行数:8,代码来源:ControllerPlayerHeli.cs


示例11: GetNeededArmorType

 public static ArmorType GetNeededArmorType(IWeapon weapon)
 {
     if (weapon.Type == DamageType.Magical)
         return ArmorType.Magical;
     if (weapon.Range == 0)
         return ArmorType.Physical;
     return ArmorType.Ranged;
 }
开发者ID:sweko,项目名称:SEDC4-CSharp,代码行数:8,代码来源:BattleHelper.cs


示例12: ApplyCostModifier

 public double ApplyCostModifier(IWeapon weapon)
 {
     if (weapon.WeaponCategory.Contains("Light"))
     {
         return weapon.WeaponCost + lightWeaponCostModifier;
     }
     return weapon.WeaponCost;
 }
开发者ID:willegetz,项目名称:notpk,代码行数:8,代码来源:AlchemicalSilver.cs


示例13: ApplyDamageModifier

 public double ApplyDamageModifier(IWeapon weapon)
 {
     if (weapon.IsBow)
     {
         return 0;
     }
     return DamageBonus;
 }
开发者ID:willegetz,项目名称:notpk,代码行数:8,代码来源:AlchemicalSilver.cs


示例14: ContextExample

        public ContextExample(IWeapon weapon1, [Ctx ("a")] IWeapon weapon2)
        {
            _weapon1 = weapon1;
              _weapon2 = weapon2;

              // Assert
              weapon1.Should().NotBeSameAs (weapon2);
        }
开发者ID:yln,项目名称:Nukito,代码行数:8,代码来源:ContextExample.cs


示例15: setHitParameters

 public void setHitParameters(Vector2 playerPosition, Vector2 dir, LayerMask hittableLayers, IWeapon currentWeapon, IWeapon[] weapons)
 {
     this.dir = new Vector2(dir.x, -dir.y);
     this.hittableLayers = hittableLayers;
     this.currentWeapon = currentWeapon;
     this.weapons = weapons;
     area = this.currentWeapon.getCharacteristic(IWeapon.Stats.AOE);
     this.playerPosition = playerPosition;
 }
开发者ID:romsahel,项目名称:explorative-platformer,代码行数:9,代码来源:Bullet.cs


示例16: CalculateTargetablePoints

 public List<EffectivePoint> CalculateTargetablePoints(IWeapon weapon, Point wielderPosition)
 {
     List<EffectivePoint> targetablePoints = new List<EffectivePoint>();
     targetablePoints.Add(new EffectivePoint(wielderPosition + new Point(1, 0), 1.0f));
     targetablePoints.Add(new EffectivePoint(wielderPosition + new Point(-1, 0), 1.0f));
     targetablePoints.Add(new EffectivePoint(wielderPosition + new Point(0, 1), 1.0f));
     targetablePoints.Add(new EffectivePoint(wielderPosition + new Point(0, -1), 1.0f));
     return targetablePoints;
 }
开发者ID:donblas,项目名称:magecrawl,代码行数:9,代码来源:Axe.cs


示例17: Add

 public override void Add(TypeOfGun type, IWeapon weapon)
 {
     KeyValuePair<TypeOfGun, IWeapon> tmp = new KeyValuePair<TypeOfGun, IWeapon>(type, weapon);
     
     if (weaponRepository.Contains(tmp) == false)
     {
         weaponRepository.Add(tmp);
     }
 }
开发者ID:VitaliyXV,项目名称:AllegroTest,代码行数:9,代码来源:WeaponCache.cs


示例18: EnchantedMagicWeapon

        public EnchantedMagicWeapon(IWeapon weapon, List<IWeaponEnchantment> weaponEnchantments)
        {
            enchantments = new List<IWeaponEnchantment>();
            LoadCriticalDamageDictionary();

            plusWeapon = QualifyWeapon(weapon);
            enchantments.AddRange(weaponEnchantments);

            // IWeapon
            WeaponName = plusWeapon.WeaponName;
            GivenName = plusWeapon.GivenName;
            Proficiency = plusWeapon.Proficiency;
            WeaponUse = plusWeapon.WeaponUse;
            WeaponCategory = plusWeapon.WeaponCategory;
            WeaponSubCategory = plusWeapon.WeaponSubCategory;
            WeaponSize = plusWeapon.WeaponSize;
            WeaponCost = plusWeapon.WeaponCost;
            Damage = plusWeapon.Damage;
            ThreatRangeLowerBound = plusWeapon.ThreatRangeLowerBound;
            CriticalDamage = plusWeapon.CriticalDamage;
            DamageType = plusWeapon.DamageType;
            Weight = plusWeapon.Weight;
            Hardness = plusWeapon.Hardness;
            HitPoints = plusWeapon.HitPoints;
            RangeIncrement = plusWeapon.RangeIncrement;
            MaxRange = plusWeapon.MaxRange;
            IsBow = plusWeapon.IsBow;

            //IForgedWeapon
            AdditionalEnchantmentCost = plusWeapon.AdditionalEnchantmentCost;
            ToHitModifier = plusWeapon.ToHitModifier;
            DamageBonus = plusWeapon.DamageBonus;
            ComponentName = plusWeapon.ComponentName;

            //IPlusEnhancedWeapon
            PlusEnhancement = plusWeapon.PlusEnhancement;
            GeneratesLight = plusWeapon.GeneratesLight;
            RequiredFeats = plusWeapon.RequiredFeats;

            //IWeaponEnhancement

            // Properties needing method assignments
            //		IWeapon
            CostModifier = TallyCostModifiers();
            ThreatRange = CalculateThreatRange();
            //		IPlusWeapon and IWeaponEnchantment
            MinimumCasterLevel = DetermineMinimumCasterLevel(plusWeapon.MinimumCasterLevel);
            MagicAura = AssembleAuras();
            //		IWeaponEnchantment
            RequiredSpells = AssembleRequiredSpells();
            AdditionalRequirements = AssembleAdditionalRequirements();
            //		Non interface implemented properties
            ModifiedRangeIncrement = CalculateRangeModifier(plusWeapon.RangeIncrement);
            ModifiedMaxRange = CalculateRangeModifier(plusWeapon.MaxRange);

            SpecialInfo = AppendSpecialInfo();
        }
开发者ID:willegetz,项目名称:notpk,代码行数:57,代码来源:EnchantedMagicWeapon.cs


示例19: ChangeWeapon

    public void ChangeWeapon( int newIndex )
    {
        InstancedWeapons[activeIndex].gameObject.SetActive(false);
        InstancedWeapons[activeIndex].PutAway();

        activeIndex = newIndex;

        activeWeapon = InstancedWeapons[activeIndex].GetComponent<IWeapon>();
        InstancedWeapons[activeIndex].gameObject.SetActive(true);
    }
开发者ID:GhostTap,项目名称:SolarStrike,代码行数:10,代码来源:WeaponScript.cs


示例20: Start

 // Use this for initialization
 void Start()
 {
     if (primaryWeaponMount != null) {
         pWeapon = primaryWeaponMount.GetComponentInChildren<IWeapon> ();
         print (pWeapon);
     }
     if (secondaryWeaponMount != null) {
         sWeapon = secondaryWeaponMount.GetComponentInChildren<IWeapon> ();
     }
 }
开发者ID:SunriseHirame,项目名称:Arcade,代码行数:11,代码来源:WeaponController.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IWebAgent类代码示例发布时间:2022-05-24
下一篇:
C# IWeakEventListener类代码示例发布时间: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