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


C# Obj_AI_Base.GetTotalHealth方法代码示例

本文整理汇总了C#中Obj_AI_Base.GetTotalHealth方法的典型用法代码示例。如果您正苦于以下问题:C# Obj_AI_Base.GetTotalHealth方法的具体用法?C# Obj_AI_Base.GetTotalHealth怎么用?C# Obj_AI_Base.GetTotalHealth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Obj_AI_Base的用法示例。


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

示例1: DrawLine

        private static void DrawLine(Obj_AI_Base unit)
        {
            var damage = _damageToUnit(unit);
            if (damage <= 0) return;

            var barPos = unit.HPBarPosition;

            //Get remaining HP after damage applied in percent and the current percent of health
            var percentHealthAfterDamage = Math.Max(0, unit.GetTotalHealth() - damage) / (unit.MaxHealth + unit.AllShield + unit.AttackShield + unit.MagicShield);
            var currentHealthPercentage = unit.GetTotalHealth() / (unit.MaxHealth + unit.AllShield + unit.AttackShield + unit.MagicShield);

            //Calculate start and end point of the bar indicator
            var startPoint = barPos.X + _xOffset + (percentHealthAfterDamage * _width);
            var endPoint = barPos.X + _xOffset + (currentHealthPercentage * _width);
            var yPos = barPos.Y + _yOffset;

            //Create a new transparent color based on the type of unit
            var color = unit is AIHeroClient ? EnemyColor : JungleColor;
            var transparentColor = Color.FromArgb(175, color);

            //Draw the line
            Drawing.DrawLine(startPoint, yPos, endPoint, yPos, _height, transparentColor);
        }
开发者ID:giaanthunder,项目名称:EloBuddy,代码行数:23,代码来源:DamageIndicator.cs

示例2: IsEnemyKillable

        private static bool IsEnemyKillable(Obj_AI_Base target)
        {
            if (target == null || !target.IsValidTarget(ArgsE.Range) || !target.HasBuff("TwitchDeadlyVenom"))
            {
                return false;
            }

            var hero = target as AIHeroClient;

            if (hero == null || IsEnemyUnkillable(hero) || HasSpellShield(hero))
            {
                return false;
            }

            if (hero.ChampionName != "Blitzcrank")
                return GetFinalEDamage(target) >= GetTotalHealth(target);

            if (!hero.HasBuff("BlitzcrankManaBarrierCD") && !hero.HasBuff("ManaBarrier"))
            {
                return GetFinalEDamage(target) > (target.GetTotalHealth() + (hero.Mana/2));
            }

            if (hero.HasBuff("ManaBarrier") && !(hero.AllShield > 0))
            {
                return false;
            }

            return GetFinalEDamage(target) >= GetTotalHealth(target);
        }
开发者ID:FireBuddy,项目名称:EloBuddy-Addons,代码行数:29,代码来源:Program.cs

示例3: DrawText

        private static void DrawText(Obj_AI_Base unit)
        {
            var damage = _damageToUnit(unit);
            if (damage <= 0) return;

            //Draw damage percentage
            if (Config.DrawMenu.IsChecked("draw.percentage")
                && (unit is AIHeroClient
                || (unit.Name.Contains("Baron") || unit.Name.Contains("Dragon") || unit.Name.Contains("Herald") || unit.Name.Contains("Blue") || unit.Name.Contains("Red"))))
            {
                var textOffsetX = 40;
                var textOffsetY = 4;

                if (!(unit is AIHeroClient))
                {
                    textOffsetX = 20;
                    textOffsetY = 8;
                }

                var percent = Math.Floor((damage / unit.GetTotalHealth()) * 100);
                if (percent >= 100 && !unit.IsRendKillable())
                {
                    Drawing.DrawText(unit.HPBarPosition.X + _xOffset + _width + textOffsetX, unit.HPBarPosition.Y + _yOffset - textOffsetY,
                        Color.Red, "Can't kill!", 20);
                }
                else
                {
                    Drawing.DrawText(unit.HPBarPosition.X + _xOffset + _width + textOffsetX, unit.HPBarPosition.Y + _yOffset - textOffsetY,
                        Color.White, unit.IsRendKillable() ? "Killable!" : percent + "%", 20);
                }
            }
        }
开发者ID:Monstertje,项目名称:EloBuddy,代码行数:32,代码来源:DamageIndicator.cs


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