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

C# Unit类代码示例

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

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



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


示例16: CellGridStateUnitSelected

 public CellGridStateUnitSelected(CellGrid cellGrid, Unit unit)
     : base(cellGrid)
 {
     _unit = unit;
     _pathsInRange = new List<Cell>();
     _unitsInRange = new List<Unit>();
 }
开发者ID:CawawaC,项目名称:Diplodocus-Project,代码行数:7,代码来源:CellGridStateUnitSelected.cs


示例17: Cast

 public static void Cast(this Ability ability, Unit unit)
 {
     if (ability.IsReady() && unit.IsValidTarget(ability.CastRange))
     {
         ability.UseAbility(unit);
     }
 }
开发者ID:ehmehe,项目名称:Ensage,代码行数:7,代码来源:iUtility.cs


示例18: Show

 public void Show(Unit Unit)
 {
     if(Unit == null)
         return;
     m_Unit = Unit;
     base.Show(true);
 }
开发者ID:przemyslaw-szymanski,项目名称:dungeonworld,代码行数:7,代码来源:BackpackGUI.cs


示例19: Tombstone

        public Tombstone(Unit unit)
        {
            this.unit = unit;
            PositionCorrection = new Vector2(25);
            var level = (uint)char.GetNumericValue(unit.Name.Last());
            Radius =
                Ability.GetAbilityDataByName(AbilityName)
                    .AbilitySpecialData.First(x => x.Name == "radius")
                    .GetValue(level - 1);
            Duration =
                Ability.GetAbilityDataByName(AbilityName)
                    .AbilitySpecialData.First(x => x.Name == "duration")
                    .GetValue(level - 1);
            Position = unit.Position;
            Texture = Drawing.GetTexture("materials/ensage_ui/other/tombstone");
            Handle = unit.Handle;
            TextureSize = new Vector2(40);
            EndTime = Game.RawGameTime + Duration;
            ShowTimer = Menu.TimerEnabled(AbilityName);

            if (Menu.RangeEnabled(AbilityName))
            {
                ParticleEffect = new ParticleEffect("particles/ui_mouseactions/drag_selected_ring.vpcf", Position);
                ParticleEffect.SetControlPoint(1, new Vector3(128, 128, 128));
                ParticleEffect.SetControlPoint(2, new Vector3(Radius, 255, 0));
            }
        }
开发者ID:IdcNoob,项目名称:Ensage,代码行数:27,代码来源:Tombstone.cs


示例20: ChildElement

        protected Line ChildElement(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)
        {
            LayoutedElement element;
            if (children == null)
            {
                element = new LayoutedElement(new TestSpecification(), Children.Empty);
            }
            else
            {
                element = new LayoutedElement(new TestSpecification(), new Children(children.GroupBy(x => x.Top).SelectMany(x => x)));
            }

            element.Left = left;
            element.ForcedInnerHeight = innerHeight;
            element.Specification.FollowLineHeight = followLineHeight;
            element.Specification.Breakable = breakable;
            element.Specification.Margins = new Margins { Bottom = border, Left = border, Right = border, Top = border };
            element.Specification.Behavior = behavior ?? new NullBehavior();

            return new Line(top, keepWithNextLine, element);
        }
开发者ID:asgerhallas,项目名称:DomFx,代码行数:29,代码来源:paging_tests.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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