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

C# IUnit类代码示例

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

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



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

示例1: Hit

        protected int Hit(IUnit enemy)
        {
            int r = 0;

            if (Unit.Param.Contains("A"))
            {
                r = 1;
                Print("(автопопадание)", 0);
            }
            else
            {
                if (Unit.WeaponSkill == enemy.WeaponSkill)
                {
                    if (check_k("ws", Unit.Param, 4, 1) != 0) { r = 1; }
                }
                if (Unit.WeaponSkill > enemy.WeaponSkill)
                {
                    if (check_k("ws", Unit.Param, 3, 1) != 0) { r = 1; }
                }
                if (Unit.WeaponSkill < enemy.WeaponSkill)
                {
                    if ((Unit.WeaponSkill * 2) < enemy.WeaponSkill)
                    {
                        if (check_k("ws", Unit.Param, 5, 1) != 0) { r = 1; }
                    }
                    else
                    {
                        if (check_k("ws", Unit.Param, 4, 1) != 0) { r = 1; }
                    }
                }
            }
            return r;
        }
开发者ID:sigma7i,项目名称:WHFB,代码行数:33,代码来源:ActionBase.cs


示例2: OgcPrimeMeridian

 /// <summary>
 /// Constructs a prime meridian.
 /// </summary>
 /// <param name="name">The name of the prime meridian.</param>
 /// <param name="longitude">The longitude location of the meridian.</param>
 /// <param name="angularUnit">The angular unit of the longitude value.</param>
 /// <param name="authority">The authority.</param>
 public OgcPrimeMeridian(string name, double longitude, IUnit angularUnit, IAuthorityTag authority = null)
     : base(name, authority)
 {
     Contract.Requires(name != null);
     Longitude = longitude;
     Unit = angularUnit ?? OgcAngularUnit.DefaultDegrees;
 }
开发者ID:aarondandy,项目名称:pigeoid,代码行数:14,代码来源:OgcPrimeMeridian.cs


示例3: Select

 public void Select(IUnit unit)
 {
     if(SelectedUnit == unit)
         return;
     SelectedUnit = unit;
     FireUnitEvent(unit, SelectedUnitChanged);
 }
开发者ID:satr,项目名称:GameProject1,代码行数:7,代码来源:Player.cs


示例4: ConvertToString

        public override LanguageDigit ConvertToString(decimal number, IUnit unit)
        {
            CheckNumber(number);
            

            if (number <= uint.MaxValue)
            {
                return ConvertToString((uint)number, unit);
            }
            
            if (number <= ulong.MaxValue)
            {
                return ConvertToString((ulong)number, unit);
            }
            


            decimal div1000 = Math.Floor(number / 1000);

            HightDigitClassesToString(div1000, 0, convertedNumber);

            DigitClassToString((uint)(number - div1000 * 1000), unit, convertedNumber);


            return this;
        }
开发者ID:chiganock,项目名称:VtecTeamFlasher,代码行数:26,代码来源:CDigitKz.cs


示例5: Wound

        protected int Wound(IUnit enemy)
        {
            int r = 0;

            int a_s = Unit.Strength;
            if (Unit.Param.Contains("B")) { a_s += 2; }

            if (a_s == enemy.Resistance)
            {
                if (check_k("s", Unit.Param, 4, 1) != 0) { r = 1; }
            }
            else if (a_s == (enemy.Resistance + 1))
            {
                if (check_k("s", Unit.Param, 3, 1) != 0) { r = 1; }
            }
            else if (a_s > (enemy.Resistance + 1))
            {
                if (check_k("s", Unit.Param, 2, 1) != 0) { r = 1; }
            }
            else if ((a_s + 1) == enemy.Resistance)
            {
                if (check_k("s", Unit.Param, 5, 1) != 0) { r = 1; }
            }
            else if ((a_s + 2) == enemy.Resistance)
            {
                if (check_k("s", Unit.Param, 6, 1) != 0) { r = 1; }
            }
            else if ((a_s + 2) < enemy.Resistance)
            {
                r = 0;
            }

            return r;
        }
开发者ID:sigma7i,项目名称:WHFB,代码行数:34,代码来源:ActionBase.cs


示例6: MoveUnit

        public void MoveUnit(int x, int y, IUnit glad)
        {
            if (IsOutOfBounds(x, y))
            {
                Text.WriteLine("");
                Text.ColorWriteLine("Cant move there!", ConsoleColor.DarkRed);
                Thread.Sleep(2000);
                return;
            }

            var unitOnTile = GetTile(x, y);

            if (unitOnTile == null)
            {
                _map[glad.CurrentTile.x, glad.CurrentTile.y] = null;
                glad.CurrentTile.y = y;
                glad.CurrentTile.x = x;
                _map[x, y] = (Tile)glad.CurrentTile;
                return;
            }

            IUnit target = GetTile(x, y).OccupyingUnit;
            (glad as Gladiator).Target = target;
            Program.GameState = GameState.Interacting;
        }
开发者ID:gabcinder2004,项目名称:GladiatorRPG,代码行数:25,代码来源:ZoneMap.cs


示例7: Init

        public void Init()
        {
            motionSimulation = new ThreadSimulationProxy(new Simulation());

            //var npc = new NPC() { ID = "Villain" };
            //motionSimulation.Insert(npc);
            //unit1 = new ThreadUnitProxy(new Unit { ID = "Unit1" }, motionSimulation);
            var us = new Simulation().CreateUnit();
            ((Unit)us).ID = "Unit1";

            unit1 = motionSimulation.CreateUnit(us);
            unit1.IntersectsUnit += new EventHandler<IObjectArgs<IUnit>>(unit1_IntersectsUnit);
            //unit1.IntersectsUnit -= new EventHandler<IObjectArgs<IUnit>>(unit1_IntersectsUnit);
            //unit1.IntersectsUnit += (sender, unit) =>
            //{
            //    DebugOutput("UNITS INTERSECTED");
            //};
            //unit1.IntersectsUnit -= (sender, unit) =>
            //{
            //    DebugOutput("UNITS INTERSECTED");
            //};
            motionSimulation.Insert(unit1);

            //var projectile = new Projectile();
            //projectile.HitsObject += new Action<Object>((o) =>
            //{
            //    DebugOutput("Projectile hit " + ((Unit)o).ID);
            //});
            //motionSimulation.Insert(projectile);
        }
开发者ID:ChristianMarchiori,项目名称:DeadMeetsLead,代码行数:30,代码来源:Program.cs


示例8: ProcessBattle

        private void ProcessBattle(IUnit currentUnit, IEnumerable<IUnit> targets, IList<IUnit> killedUnits)
        {
            foreach (var target in targets)
            {
                var attack = currentUnit.CombatHandler.GenerateAttack();

                int healthDamage = attack.Damage - target.DefensePoints;
                if (healthDamage > 0)
                {
                    target.HealthPoints -= healthDamage;

                    this.Engine.OutputWriter.Write(string.Format(
                        "{0} cast {1} on {2} for {3} damage",
                        currentUnit.Name,
                        attack.GetType().Name,
                        target.Name,
                        healthDamage));

                    if (target.HealthPoints < 0)
                    {
                        target.HealthPoints = 0;

                        this.Engine.OutputWriter.Write(string.Format(
                            "{0} has killed {1}",
                            currentUnit.Name,
                            target.Name));

                        killedUnits.Add(target);
                    }
                }
            }
        }
开发者ID:LyuboslavLyubenov,项目名称:OOP,代码行数:32,代码来源:FightCommand.cs


示例9: Times

        /// <summary>
        /// Converts the distance into area
        /// </summary>
        /// <param name="d1"></param>
        /// <param name="d2"></param>
        /// <returns></returns>
        public static IUnit<IArea> Times(this IUnit<IDistance> d1, IUnit<IDistance> d2)
        {
            var f1 = d1.In().Feet;
            var f2 = d2.In().Feet;

            return (f1.Quantity * f2.Quantity).Square().Feet;
        }
开发者ID:amirci,项目名称:mt_units,代码行数:13,代码来源:UnitExtensions.Operators.cs


示例10: GetConversionsTo

 public override IEnumerable<IUnitConversion<double>> GetConversionsTo(IUnit to)
 {
     Contract.Ensures(Contract.Result<IEnumerable<IUnitConversion<double>>>() != null);
     return AreUnitsMatching(_singleUnit, to)
         ? new[] { new UnitUnityConversion(_singleUnit, to) }
         : Enumerable.Empty<IUnitConversion<double>>();
 }
开发者ID:aarondandy,项目名称:pigeoid,代码行数:7,代码来源:SingleUnityUnitConversionMap.cs


示例11: SingleUnityUnitConversionMap

 public SingleUnityUnitConversionMap(IUnit unit, IEqualityComparer<IUnit> unitEqualityComparer = null)
     : base(unitEqualityComparer)
 {
     if (null == unit) throw new ArgumentNullException("unit");
     Contract.EndContractBlock();
     _singleUnit = unit;
 }
开发者ID:aarondandy,项目名称:pigeoid,代码行数:7,代码来源:SingleUnityUnitConversionMap.cs


示例12: ConvertToString

        /// <summary>
        /// Получить пропись числа с согласованной единицей измерения.
        /// </summary>
        /// <param name="doubleDigit"> 
        /// CDigit должно быть целым, неотрицательным, не большим <see cref="MaxDouble"/>. 
        /// </param>
        /// <param name="unit"></param>
        /// <param name="result"> Сюда записывается результат. </param>
        /// <exception cref="ArgumentException">
        /// Если doubleDigit меньше нуля, не целое или больше <see cref="MaxDouble"/>. 
        /// </exception>
        /// <returns> <paramref name="result"/> </returns>
        /// <remarks>
        /// float по умолчанию преобразуется к double, поэтому нет перегрузки для float.
        /// В результате ошибок округления возможно расхождение цифр прописи и
        /// строки, выдаваемой double.ToString ("R"), начиная с 17 значащей цифры.
        /// </remarks>
        public static StringBuilder ConvertToString(double doubleDigit, IUnit unit, StringBuilder result)
        {
            string error = CheckDigit(doubleDigit);
            if (error != null) throw new ArgumentException(error, "число");

            if (doubleDigit <= uint.MaxValue)
            {
                ConvertToString((uint)doubleDigit, unit, result);
            }
            else if (doubleDigit <= ulong.MaxValue)
            {
                // SumConvertToString с ulong выполняется в среднем в 2 раза быстрее.
                ConvertToString((ulong)doubleDigit, unit, result);
            }
            else
            {
                MyStringBuilder mySb = new MyStringBuilder(result);

                double div1000 = Math.Floor(doubleDigit / 1000);
                HightDigitClassesToString(div1000, 0, mySb);
                DigitClassToString((uint)(doubleDigit - div1000 * 1000), unit, mySb);
            }

            return result;
        }
开发者ID:chiganock,项目名称:VtecTeamFlasher,代码行数:42,代码来源:CDigit.cs


示例13: Attack

        public override int Attack(IUnit enemy)
        {
            int r = 0;

            if ((Unit.LifePoints > 0) && (enemy.LifePoints > 0))
            {
                Print("\n" + Unit.Name + " --> попадание", 0);
                if (Hit(enemy) != 0)
                {
                    Print(" --> ранение ", 0);
                    if (Wound(enemy) != 0)
                    {
                        Print(" --> броня ", 0);
                        if (NotAs(Unit) != 0)
                        {
                            if (enemy.Ward != 0)
                            {
                                Print(" --> особая защита ", 0);
                            }
                            if (not_ward(enemy) != 0)
                            {
                                Print(" --> " + enemy.Name + " РАНЕН", 2);
                                r = 1;
                            }
                        }
                    }
                }
                if (r == 0)
                {
                    Print(" --> не получилось", 1);
                }
            }
            return r;
        }
开发者ID:sigma7i,项目名称:WHFB,代码行数:34,代码来源:SimpleAction.cs


示例14: Spell

 public Spell(IUnit unit, int energyCost, int damage)
 {
     this.Unit = unit;
     this.Targets = targets;
     this.Damage = damage;
     this.EnergyCost = energyCost;
 }
开发者ID:simooo93,项目名称:Exams,代码行数:7,代码来源:Spell.cs


示例15: RelativeVector

 /// <summary>
 /// value is on line between units and on the dist form unit1
 /// </summary>
 /// <param name="unit1">first unit</param>
 /// <param name="unit2">second unit</param>
 /// <param name="Dist">distance from unit1</param>
 public RelativeVector(IUnit unit1, IUnit unit2, float Dist)
 {
     relativeUnit1 = unit1;
     relativeUnit2 = unit2;
     dist = Dist;
     mode = Modes.BetweenUnitsNearOne;
 }
开发者ID:Lord-Prizrak,项目名称:codecraft-game,代码行数:13,代码来源:RelativeVector.cs


示例16: ChangeUnitLocation

 private void ChangeUnitLocation(IPath pathToTheTargetPlanet, IUnit unitToTeleport, ILocation targetLocation)
 {
     pathToTheTargetPlanet.TargetLocation.Planet.Units.Add(unitToTeleport);
     unitToTeleport.CurrentLocation.Planet.Units.Remove(unitToTeleport);
     unitToTeleport.PreviousLocation = unitToTeleport.CurrentLocation;
     unitToTeleport.CurrentLocation = targetLocation;
 }
开发者ID:Xristinaaaa,项目名称:Telerik2016,代码行数:7,代码来源:TeleportStation.cs


示例17: CreateUnit

        public IUnit CreateUnit(IUnit unitType)
        {
            var spawnedUnit = unitType.Spawn();
            this.UnitsManufactured += 1;

            return spawnedUnit;
        }
开发者ID:InKolev,项目名称:TelerikAcademy,代码行数:7,代码来源:Example.cs


示例18: LoadUnit

 /// <summary>
 /// Loads a unit into the host
 /// </summary>
 /// <param name="unit">Unit to load</param>
 public void LoadUnit( IUnit unit )
 {
     Arguments.CheckNotNull( unit, "unit" );
     Log.Info( "Loading unit " + unit);
     unit.Initialize( m_Environment );
     m_Units.Add( unit );
 }
开发者ID:johann-gambolputty,项目名称:robotbastards,代码行数:11,代码来源:AbstractHost.cs


示例19: Unit

 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="source">The unit to copy</param>
 public Unit(IUnit source)
 {
     Description = source.Description;
     ID = source.ID;
     ConversionFactorToSI = source.ConversionFactorToSI;
     OffSetToSI = source.OffSetToSI;
 }
开发者ID:KangChaofan,项目名称:OOC,代码行数:11,代码来源:Unit.cs


示例20: localComm

 public Intracommunicator localComm(IUnit caller)
 {
     Intracommunicator _localComm;
        //_localComm = (Intracommunicator)Communicator.world.Create(Communicator.world.Group.IncludeOnly(caller.Ranks));
        _localComm = (Intracommunicator)this.WorldComm.Create(this.WorldComm.Group.IncludeOnly(caller.Ranks));
        return _localComm;
 }
开发者ID:UFC-MDCC-HPC,项目名称:NPB-for-HPE,代码行数:7,代码来源:IMPIDirectImpl.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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