本文整理汇总了C#中System.Vector2.isNearEnemy方法的典型用法代码示例。如果您正苦于以下问题:C# Vector2.isNearEnemy方法的具体用法?C# Vector2.isNearEnemy怎么用?C# Vector2.isNearEnemy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Vector2
的用法示例。
在下文中一共展示了Vector2.isNearEnemy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanHeroWalkToPos
public static PositionInfo CanHeroWalkToPos(Vector2 pos, float speed, float delay, float extraDist, bool useServerPosition = true)
{
int posDangerLevel = 0;
int posDangerCount = 0;
float closestDistance = float.MaxValue;
List<int> dodgeableSpells = new List<int>();
List<int> undodgeableSpells = new List<int>();
Vector2 heroPos = ObjectCache.myHeroCache.serverPos2D;
var minComfortDistance = ObjectCache.menuCache.cache["MinComfortZone"].Cast<Slider>().CurrentValue;
if (useServerPosition == false)
{
heroPos = myHero.Position.LSTo2D();
}
foreach (KeyValuePair<int, Spell> entry in SpellDetector.spells)
{
Spell spell = entry.Value;
var moveBuff = EvadeSpell.evadeSpells.OrderBy(s => s.dangerlevel).FirstOrDefault(s => s.evadeType == EvadeType.MovementSpeedBuff);
if (moveBuff != null && EvadeSpell.ShouldUseMovementBuff(spell))
{
speed += speed * moveBuff.speedArray[myHero.GetSpell(moveBuff.spellKey).Level - 1] / 100;
}
closestDistance = Math.Min(closestDistance, GetClosestDistanceApproach(spell, pos, speed, delay, heroPos, extraDist));
if (pos.InSkillShot(spell, ObjectCache.myHeroCache.boundingRadius - 6)
|| PredictSpellCollision(spell, pos, speed, delay, heroPos, extraDist, useServerPosition)
|| (spell.info.spellType != SpellType.Line && pos.isNearEnemy(minComfortDistance)))
{
posDangerLevel = Math.Max(posDangerLevel, spell.dangerlevel);
posDangerCount += spell.dangerlevel;
undodgeableSpells.Add(spell.spellID);
}
else
{
dodgeableSpells.Add(spell.spellID);
}
}
return new PositionInfo(
pos,
posDangerLevel,
posDangerCount,
posDangerCount > 0,
closestDistance,
dodgeableSpells,
undodgeableSpells);
}
示例2: CanHeroWalkToPos
public static PositionInfo CanHeroWalkToPos(Vector2 pos, float speed, float delay, float extraDist, bool useServerPosition = true)
{
int posDangerLevel = 0;
int posDangerCount = 0;
float closestDistance = float.MaxValue;
List<int> dodgeableSpells = new List<int>();
List<int> undodgeableSpells = new List<int>();
Vector2 heroPos = ObjectCache.myHeroCache.serverPos2D;
var minComfortDistance = ObjectCache.menuCache.cache["MinComfortZone"].GetValue<Slider>().Value;
if (useServerPosition == false)
{
heroPos = myHero.Position.To2D();
}
foreach (KeyValuePair<int, Spell> entry in SpellDetector.spells)
{
Spell spell = entry.Value;
closestDistance = Math.Min(closestDistance, GetClosestDistanceApproach(spell, pos, speed, delay, heroPos, extraDist));
//GetIntersectTime(spell, ObjectCache.myHeroCache.serverPos2D, pos);
//Math.Min(closestDistance, GetClosestDistanceApproach(spell, pos, ObjectCache.myHeroCache.moveSpeed, delay, ObjectCache.myHeroCache.serverPos2D));
if (pos.InSkillShot(spell, ObjectCache.myHeroCache.boundingRadius + 6)
|| PredictSpellCollision(spell, pos, speed, delay, heroPos, extraDist)
|| pos.IsUnderTurret()
|| (spell.info.spellType != SpellType.Line && pos.isNearEnemy(minComfortDistance)))
{
posDangerLevel = Math.Max(posDangerLevel, spell.dangerlevel);
posDangerCount += spell.dangerlevel;
undodgeableSpells.Add(spell.spellID);
}
else
{
dodgeableSpells.Add(spell.spellID);
}
}
return new PositionInfo(
pos,
posDangerLevel,
posDangerCount,
posDangerCount > 0,
closestDistance,
dodgeableSpells,
undodgeableSpells);
}