当前位置: 首页>>代码示例>>C#>>正文


C# AIHeroClient.RealPath方法代码示例

本文整理汇总了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;
        }
开发者ID:stefsot,项目名称:EloBuddyAddons,代码行数:35,代码来源:EvadePlus.cs

示例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;
        }
开发者ID:newchild,项目名称:EloBuddyAddons,代码行数:70,代码来源:EvadePlus.cs


注:本文中的AIHeroClient.RealPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。