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


C# AIHeroClient.WalkingTime方法代码示例

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

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


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