本文整理汇总了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;
}
}