當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。