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


C# Hero.Where方法代码示例

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


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

示例1: UpdateDamage

        public static void UpdateDamage(Hero[] enemyHeroes, Hero[] allyHeroes)
        {
            if (!Utils.SleepCheck("GankDamage.Update"))
            {
                return;
            }
            if (!OnUpdateChecks.CanUpdate() || !MainMenu.GankDamageMenu.Item("enableGankDamage").GetValue<bool>())
            {
                return;
            }
            enemies = enemyHeroes;
            allies = allyHeroes;
            Utils.Sleep(1000, "GankDamage.Update");
            if (MainMenu.GankDamageMenu.Item("enableGankDamageEnemies").GetValue<bool>())
            {
                foreach (var enemyHero in enemyHeroes)
                {
                    var hero = enemyHero;
                    var heroName = NameManager.Name(hero);
                    if (!IncomingDamages.ContainsKey(heroName))
                    {
                        IncomingDamages.Add(heroName, 0);
                    }
                    var tempDmg = 0f;
                    foreach (
                        var allyHero in
                            allyHeroes.Where(
                                x =>
                                AllyHeroes.AbilityDictionary.ContainsKey(NameManager.Name(x))
                                && AllyHeroes.ItemDictionary.ContainsKey(NameManager.Name(x))
                                && x.Distance2D(hero) < 1700))
                    {
                        var abilities = AllyHeroes.AbilityDictionary[NameManager.Name(allyHero)];
                        var items = AllyHeroes.ItemDictionary[NameManager.Name(allyHero)].Where(x => x.IsValid).ToList();
                        var list = new List<Ability>(abilities.Count + items.Count);
                        list.AddRange(abilities);
                        list.AddRange(items);
                        tempDmg +=
                            list.Where(x => x.CanBeCasted())
                                .Sum(ability => AbilityDamage.CalculateDamage(ability, allyHero, hero));
                    }
                    IncomingDamages[heroName] = tempDmg;
                }
            }

            if (!MainMenu.GankDamageMenu.Item("enableGankDamageAllies").GetValue<bool>())
            {
                return;
            }
            foreach (var allyHero in allyHeroes)
            {
                var hero = allyHero;
                var heroName = NameManager.Name(hero);
                if (!IncomingDamages.ContainsKey(heroName))
                {
                    IncomingDamages.Add(heroName, 0);
                }
                var tempDmg = 0f;
                foreach (
                    var enemyHero in
                        enemyHeroes.Where(
                            x =>
                            EnemyHeroes.AbilityDictionary.ContainsKey(NameManager.Name(x))
                            && EnemyHeroes.ItemDictionary.ContainsKey(NameManager.Name(x)) && x.Distance2D(hero) < 1700)
                    )
                {
                    var abilities = EnemyHeroes.AbilityDictionary[NameManager.Name(enemyHero)];
                    var items = EnemyHeroes.ItemDictionary[NameManager.Name(enemyHero)].Where(x => x.IsValid).ToList();
                    var list = new List<Ability>(abilities.Count + items.Count);
                    list.AddRange(abilities);
                    list.AddRange(items);
                    tempDmg +=
                        list.Where(x => x.CanBeCasted())
                            .Sum(ability => AbilityDamage.CalculateDamage(ability, enemyHero, hero));
                }
                IncomingDamages[heroName] = tempDmg;
            }
        }
开发者ID:dendimonster,项目名称:EnsageSharp,代码行数:78,代码来源:GankDamage.cs


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