本文整理汇总了C#中LeagueSharp.Common.Geometry.Polygon.Circle.OrderBy方法的典型用法代码示例。如果您正苦于以下问题:C# Geometry.Polygon.Circle.OrderBy方法的具体用法?C# Geometry.Polygon.Circle.OrderBy怎么用?C# Geometry.Polygon.Circle.OrderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LeagueSharp.Common.Geometry.Polygon.Circle
的用法示例。
在下文中一共展示了Geometry.Polygon.Circle.OrderBy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BestQPosition
private Tuple<int, Vector3> BestQPosition(Obj_AI_Base target, List<Obj_AI_Base> targets, HitChance hitChance)
{
var castPos = Vector3.Zero;
var totalHits = 0;
try
{
var enemies = targets.Where(e => e.IsValidTarget(Q.Range * 1.5f)).ToList();
var enemyPositions = new List<Tuple<Obj_AI_Base, Vector3>>();
var circle = new Geometry.Polygon.Circle(Player.Position, Player.BoundingRadius, 30).Points;
foreach (var h in enemies)
{
var ePred = Q.GetPrediction(h);
if (ePred.Hitchance >= hitChance)
{
circle.Add(Player.Position.Extend(ePred.UnitPosition, Player.BoundingRadius).To2D());
enemyPositions.Add(new Tuple<Obj_AI_Base, Vector3>(h, ePred.UnitPosition));
}
}
var targetPos = target == null ? Vector3.Zero : target.Position;
if (target == null)
{
var possibilities =
ListExtensions.ProduceEnumeration(enemyPositions).Where(p => p.Count > 0).ToList();
var count = 0;
foreach (var possibility in possibilities)
{
var mec = MEC.GetMec(possibility.Select(p => p.Item2.To2D()).ToList());
if (mec.Radius < Q.Width && possibility.Count > count)
{
count = possibility.Count;
targetPos = mec.Center.To3D();
}
}
}
if (targetPos.Equals(Vector3.Zero))
{
return new Tuple<int, Vector3>(totalHits, castPos);
}
circle = circle.OrderBy(c => c.Distance(targetPos)).ToList();
if (!enemyPositions.Any())
{
return new Tuple<int, Vector3>(totalHits, castPos);
}
foreach (var point in circle)
{
var hits = 0;
var containsTarget = false;
var direction = Q.Range * (point.To3D() - ObjectManager.Player.Position).Normalized().To2D();
var rect1 = new Geometry.Polygon.Rectangle(
Player.Position, Player.Position.Extend(Player.Position + direction.To3D(), Q.Range), Q.Width);
var rect2 = new Geometry.Polygon.Rectangle(
Player.Position,
Player.Position.Extend(Player.Position + direction.Rotated(QAngle).To3D(), Q.Range), Q.Width);
var rect3 = new Geometry.Polygon.Rectangle(
Player.Position,
Player.Position.Extend(Player.Position + direction.Rotated(-QAngle).To3D(), Q.Range), Q.Width);
foreach (var enemy in enemyPositions)
{
var bounding = new Geometry.Polygon.Circle(enemy.Item2, enemy.Item1.BoundingRadius * 0.85f);
if (bounding.Points.Any(p => rect1.IsInside(p) || rect2.IsInside(p) || rect3.IsInside(p)))
{
hits++;
if (target != null && enemy.Item1.NetworkId.Equals(target.NetworkId))
{
containsTarget = true;
}
}
}
if ((containsTarget || target == null) && hits > totalHits)
{
totalHits = hits;
castPos = Player.Position.Extend(point.To3D(), Q.Range);
if (totalHits >= enemies.Count)
{
break;
}
}
}
}
catch (Exception ex)
{
Global.Logger.AddItem(new LogItem(ex));
}
return new Tuple<int, Vector3>(totalHits, castPos);
}