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


C# Unit类代码示例

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


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

示例1: AddModifierObstacle

 public void AddModifierObstacle(Modifier modifier, Unit unit)
 {
     if (Obstacle != null)
     {
         End();
     }
 }
开发者ID:IdcNoob,项目名称:Ensage,代码行数:7,代码来源:Chakram.cs

示例2: CheckTarget

        private static bool CheckTarget(Unit enemy, bool doubleOwnage = false)
        {
            if (enemy.IsIllusion || !enemy.IsValidTarget(dagon.GetCastRange(), true, hero.NetworkPosition))
            {
                return false;
            }

            if (enemy.IsLinkensProtected() || enemy.IsMagicImmune())
            {
                return false;
            }

            if (!enemy.CanDie() || enemy.Modifiers.Any(x => IgnoreModifiers.Any(x.Name.Equals)))
            {
                return false;
            }

            var damage = AbilityDamage.CalculateDamage(dagon, hero, enemy);

            if (doubleOwnage)
            {
                damage *= 2;
            }

            return enemy.Health < damage;
        }
开发者ID:IdcNoob,项目名称:Ensage,代码行数:26,代码来源:Program.cs

示例3: AddUnit

 public void AddUnit(Unit unit)
 {
     abilityUnit = unit;
     StartCast = Game.RawGameTime;
     EndCast = Game.RawGameTime + GetCastRange() / GetProjectileSpeed();
     StartPosition = unit.Position;
 }
开发者ID:IdcNoob,项目名称:Ensage,代码行数:7,代码来源:Tornado.cs

示例4: Element

        protected Line Element(Unit left = default(Unit),
            Unit top = default(Unit),
            Unit innerHeight = default(Unit),
            bool breakable = false,
            bool followLineHeight = false,
            Unit border = default(Unit),
            bool keepWithNextLine = false,
            Behaviors behavior = null,
            IEnumerable<Line> children = null)
        {
            // Top offsets are not allowed in real usage, so we fake one by adding an element
            if (lines.Count == 0 && top > 0.cm())
            {
                lines.Add(new Line(0.cm(), false, new LayoutedElement(new TestSpecification
                {
                    Breakable = true,
                    OrphanHeight = 0.cm(),
                    WidowHeight = 0.cm()
                }, Children.Empty)
                {
                    Name = "Spacer",
                    ForcedInnerHeight = top,
                }));
            }

            var line = ChildElement(left, top, innerHeight, breakable, followLineHeight, border, keepWithNextLine, behavior, children);
            lines.Add(line);
            return line;
        }
开发者ID:asgerhallas,项目名称:DomFx,代码行数:29,代码来源:paging_tests.cs

示例5: RunEffect

	public override void RunEffect(Unit u, bool reapply = false)
	{
		base.RunEffect(u, reapply);

		//give shield
		u.shield += shieldAmount;
	}
开发者ID:JohnEz,项目名称:TileBasedEngine,代码行数:7,代码来源:ShieldEffect.cs

示例6: OnEnable

 void OnEnable()
 {
     Owner = GetComponent<Unit>();
     MainController.Instance.FocusedUnit = Owner;
     MainController.Instance.SwitchSkill(0);
     MainController.Instance.MoveControlPad.Init(Owner);
 }
开发者ID:stv1024,项目名称:JoystickInnovation,代码行数:7,代码来源:PlayerUnit.cs

示例7: ReportGauge

 protected override void ReportGauge(string name, double value, Unit unit, MetricTags tags)
 {
     if (!double.IsNaN(value) && !double.IsInfinity(value))
     {
         Pack(name, value, tags);
     }
 }
开发者ID:mnadel,项目名称:metrics.net.influxdb,代码行数:7,代码来源:InfluxDbReport.cs

示例8: OneUnitDefaultName

        public void OneUnitDefaultName()
        {
            var meter = new Unit("meter");
            var oneMeter = new Measurement(meter, 1M);

            oneMeter.ToString().Should().Be("1 meter");
        }
开发者ID:hartez,项目名称:Convertinator,代码行数:7,代码来源:MeasurementOutputTests.cs

示例9: OnShow

    protected override void OnShow()
    {
        if(m_Unit == null)
            m_Unit = base.Player.CurrentPartyUnit;

        Prepare();
    }
开发者ID:przemyslaw-szymanski,项目名称:dungeonworld,代码行数:7,代码来源:EquipmentGUI.cs

示例10: OunceAndPound

 public void OunceAndPound(Unit unit, Unit servingSizeUnit)
 {
     sut.Unit = unit;
     Assert.IsTrue(sut.AnyNutrientsPerUnitPresent);
     Assert.IsTrue(sut.AreNutrientsPer100gUsable);
     Assert.IsFalse(sut.AreNutrientsPerServingUsable);
     product.ServingSizeValue = 1;
     product.ServingSizeUnit = servingSizeUnit;
     Assert.IsTrue(sut.AnyNutrientsPerUnitPresent);
     Assert.IsTrue(sut.AreNutrientsPer100gUsable);
     Assert.IsTrue(sut.AreNutrientsPerServingUsable);
     product.EnergyPerServing = 0;
     Assert.IsTrue(sut.AnyNutrientsPerUnitPresent);
     Assert.IsTrue(sut.AreNutrientsPer100gUsable);
     Assert.IsFalse(sut.AreNutrientsPerServingUsable);
     sut.Unit = Unit.ServingSize;
     Assert.IsTrue(sut.AnyNutrientsPerUnitPresent);
     Assert.IsTrue(sut.AreNutrientsPer100gUsable);
     Assert.IsFalse(sut.AreNutrientsPerServingUsable);
     product.EnergyPerServing = 100;
     Assert.IsTrue(sut.AnyNutrientsPerUnitPresent);
     Assert.IsFalse(sut.AreNutrientsPer100gUsable);
     Assert.IsTrue(sut.AreNutrientsPerServingUsable);
     product.EnergyPer100g = 0;
     sut.Unit = unit;
     Assert.IsTrue(sut.AnyNutrientsPerUnitPresent);
     Assert.IsFalse(sut.AreNutrientsPer100gUsable);
     Assert.IsTrue(sut.AreNutrientsPerServingUsable);
 }
开发者ID:PawelStroinski,项目名称:Diettr-GPL,代码行数:29,代码来源:UnitUsabilityTests.cs

示例11: CancelAction

 //Cancel the currently displayed action
 public void CancelAction()
 {
     selectedUnit = null;
     m_tiles.ClearSelectedTiles();
     m_hud.HideUnitInfo();
     e_playerState = PlayerState.Default;
 }
开发者ID:mjz4277,项目名称:Terraforma,代码行数:8,代码来源:PlayerController.cs

示例12: AttackUnit

 public static bool AttackUnit(Unit unit, TimeSpan timeout)
 {
     if (unit.Type == UnitType.Monster
         && unit.GetAttributeInteger(UnitAttribute.Is_NPC) == 0
         && unit.GetAttributeInteger(UnitAttribute.Is_Helper) == 0
         && unit.GetAttributeInteger(UnitAttribute.Invulnerable) == 0)
     {
         switch (Me.SNOId)
         {
             case SNOActorId.Barbarian_Male:
             case SNOActorId.Barbarian_Female:
                 //return Classes.Barbarian.AttackUnit(unit, timeout);
                 break;
             case SNOActorId.WitchDoctor_Male:
             case SNOActorId.WitchDoctor_Female:
                 //return Classes.WitchDoctor.AttackUnit(unit, timeout);
                 break;
             case SNOActorId.Wizard_Male:
             case SNOActorId.Wizard_Female:
                 //return Classes.Wizard.AttackUnit(unit, timeout);
                 break;
             case SNOActorId.Demonhunter_Male:
             case SNOActorId.Demonhunter_Female:
                 return DemonHunter.AttackUnit(unit, timeout);
             case SNOActorId.Monk_Male:
             case SNOActorId.Monk_Female:
                 return Monk.AttackUnit(unit, timeout);
         }
     }
     return false;
 }
开发者ID:murrain,项目名称:Snowshoes,代码行数:31,代码来源:Attack.cs

示例13: ChainStun

 public static bool ChainStun(Unit unit, double delay, string except, bool onlychain)
 {
     var chain = false;
     var stunned = false;
     string[] modifiersList =
     {
         "modifier_shadow_demon_disruption", "modifier_obsidian_destroyer_astral_imprisonment_prison",
         "modifier_eul_cyclone", "modifier_invoker_tornado", "modifier_bane_nightmare",
         "modifier_shadow_shaman_shackles",
         "modifier_crystal_maiden_frostbite", "modifier_ember_spirit_searing_chains",
         "modifier_axe_berserkers_call",
         "modifier_lone_druid_spirit_bear_entangle_effect", "modifier_meepo_earthbind",
         "modifier_naga_siren_ensnare",
         "modifier_storm_spirit_electric_vortex_pull", "modifier_treant_overgrowth", "modifier_cyclone",
         "modifier_sheepstick_debuff", "modifier_shadow_shaman_voodoo", "modifier_lion_voodoo",
         "modifier_brewmaster_storm_cyclone",
         "modifier_puck_phase_shift", "modifier_dark_troll_warlord_ensnare",
         "modifier_invoker_deafening_blast_knockback"
     };
     var modifiers = unit.Modifiers.OrderByDescending(x => x.RemainingTime);
     foreach (var m in modifiers.Where(m => (m.IsStunDebuff || modifiersList.Contains(m.Name)) && (except == null || m.Name == except)))
     {
         stunned = true;
         var remainingTime = m.RemainingTime;
         if (m.Name == "modifier_eul_cyclone" || m.Name == "modifier_invoker_tornado")
             remainingTime += 0.07f;
         chain = remainingTime <= delay;
     }
     return ((((!(stunned || unit.IsStunned()) || chain) && !onlychain) || (onlychain && chain)));
 }
开发者ID:Esk0r,项目名称:Ensage.Common,代码行数:30,代码来源:Utils.cs

示例14: Update

        public override void Update(Unit unit, IGame game)
        {
            base.Update(unit, game);

            if ((game.Time - unit.BirthTime) > FleeTime)
                unit.setState(UnitFactories.States.Create(unit.Name, "fleeing"), game);
        }
开发者ID:Chirimorin,项目名称:DuckHunt,代码行数:7,代码来源:AliveUnitState.cs

示例15: AddEnermy

    public void AddEnermy(Unit addUnit)
    {
        bool b_set = false;

        addUnit.m_ai.m_TeamType = eUnitType.Enermy;

        for (int i = 0; i < m_enermyUnitList.Count; ++i)
        {
            if(m_enermyUnitList[i] == null)
            {
                m_enermyUnitList[i] = addUnit;
                b_set = true;
                break;
            }
        }
        if(b_set == false)
        {
            m_enermyUnitList.Add(addUnit);
        }

        if(NewUnitCall != null)
        {
            NewUnitCall(addUnit);
        }
    }
开发者ID:seonwifi,项目名称:bongbong,代码行数:25,代码来源:UnitMgr.cs


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