本文整理汇总了C#中AIHeroClient.WalkingTime方法的典型用法代码示例。如果您正苦于以下问题:C# AIHeroClient.WalkingTime方法的具体用法?C# AIHeroClient.WalkingTime怎么用?C# AIHeroClient.WalkingTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AIHeroClient
的用法示例。
在下文中一共展示了AIHeroClient.WalkingTime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsPathSafeEx
public bool IsPathSafeEx(Vector2[] path, AIHeroClient hero = null)
{
hero = hero ?? Player.Instance;
for (var i = 0; i < path.Length - 1; i++)
{
var start = path[i];
var end = path[i + 1];
foreach (var pair in _skillshotPolygonCache)
{
var skillshot = pair.Key;
var polygon = pair.Value;
if (polygon.IsInside(start) && polygon.IsInside(end))
{
//var time1 = skillshot.GetAvailableTime(start);
var time2 = skillshot.GetAvailableTime(end);
if (hero.WalkingTime(start, end) >= time2 - Game.Ping)
{
return false;
}
}
else
{
var intersections =
polygon.GetIntersectionPointsWithLineSegment(start, end)
.Concat(new[] {start, end})
.ToList()
.GetSortedPath(start).ToArray();
for (var i2 = 0; i2 < intersections.Length - 1; i2++)
{
var point1 = intersections[i2];
var point2 = intersections[i2 + 1];
if (polygon.IsInside(point2) || polygon.IsInside(point1))
{
//var time1 = polygon.IsInside(point1) ? skillshot.GetAvailableTime(point1) : short.MaxValue;
var time2 = polygon.IsInside(point2) ? skillshot.GetAvailableTime(point2) : short.MaxValue;
if (hero.WalkingTime(point1, point2) >= time2 - Game.Ping)
{
return false;
}
}
}
}
}
}
return true;
}
示例2: IsHeroPathSafe
public bool IsHeroPathSafe(EvadeResult evade, Vector3[] desiredPath, AIHeroClient hero = null)
{
hero = hero ?? Player.Instance;
var path = (desiredPath ?? hero.RealPath()).ToVector2();
return IsPathSafeEx(path, hero);
var polygons = ClippedPolygons;
var points = new List<Vector2>();
for (var i = 0; i < path.Length - 1; i++)
{
var start = path[i];
var end = path[i + 1];
foreach (var pol in polygons)
{
var intersections = pol.GetIntersectionPointsWithLineSegment(start, end);
if (intersections.Length > 0 && !pol.IsInside(hero))
{
return false;
}
points.AddRange(intersections);
}
}
if (points.Count == 1)
{
var walkTime = hero.WalkingTime(points[0]);
return walkTime <= evade.TimeAvailable;
}
return false;
}