本文整理汇总了C#中AIHeroClient.RealPath方法的典型用法代码示例。如果您正苦于以下问题:C# AIHeroClient.RealPath方法的具体用法?C# AIHeroClient.RealPath怎么用?C# AIHeroClient.RealPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AIHeroClient
的用法示例。
在下文中一共展示了AIHeroClient.RealPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: DoEvade
public bool DoEvade(AIHeroClient hero = null, Vector3[] desiredPath = null)
{
if (!EvadeEnabled || Player.Instance.IsDead)
{
LastEvadeResult = null;
AutoPathing.StopPath();
return false;
}
hero = hero ?? Player.Instance;
if (IsHeroInDanger(hero))
{
if (LastEvadeResult != null && (!IsPointSafe(LastEvadeResult.EvadePoint) || LastEvadeResult.Expired()))
{
LastEvadeResult = null;
}
var evade = CalculateEvade(LastIssueOrderPos);
if (evade.IsValid && evade.EnoughTime)
{
if (LastEvadeResult == null ||
(LastEvadeResult.EvadePoint.Distance(evade.EvadePoint, true) > 300.Pow()))
{
LastEvadeResult = evade;
}
if (IsHeroPathSafe(evade, desiredPath))
{
LastEvadeResult = null;
}
}
else
{
if (!evade.EnoughTime && LastEvadeResult == null && !IsHeroPathSafe(evade, desiredPath))
{
return EvadeSpellManager.ProcessFlash(this);
}
}
if (LastEvadeResult != null)
{
if (!hero.IsMovingTowards(LastEvadeResult.EvadePoint))
{
AutoPathing.StopPath();
Player.IssueOrder(GameObjectOrder.MoveTo, LastEvadeResult.EvadePoint.To3DWorld(), false);
}
return true;
}
}
else if (!IsPathSafe(hero.RealPath()) || (desiredPath != null && !IsPathSafe(desiredPath)))
{
var path = GetPath(hero.Position.To2D(), LastIssueOrderPos);
if (path.Length > 0 && AutoPathing.Destination.Distance(path.Last(), true) > 50.Pow())
{
AutoPathing.DoPath(path);
}
LastEvadeResult = null;
return true;
}
else
{
AutoPathing.StopPath();
LastEvadeResult = null;
}
return false;
}