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


C# Vector2.HasExtraAvoidDistance方法代码示例

本文整理汇总了C#中System.Vector2.HasExtraAvoidDistance方法的典型用法代码示例。如果您正苦于以下问题:C# Vector2.HasExtraAvoidDistance方法的具体用法?C# Vector2.HasExtraAvoidDistance怎么用?C# Vector2.HasExtraAvoidDistance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Vector2的用法示例。


在下文中一共展示了Vector2.HasExtraAvoidDistance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetBestPositionMovementBlock

        public static PositionInfo GetBestPositionMovementBlock(Vector2 movePos)
        {
            int posChecked = 0;
            int maxPosToCheck = 50;
            int posRadius = 50;
            int radiusIndex = 0;

            var extraEvadeDistance = ObjectCache.menuCache.cache["ExtraAvoidDistance"].Cast<Slider>().CurrentValue;

            Vector2 heroPoint = ObjectCache.myHeroCache.serverPos2D;
            Vector2 lastMovePos = movePos;//Game.CursorPos.To2D(); //movePos

            List<PositionInfo> posTable = new List<PositionInfo>();

            var extraDist = ObjectCache.menuCache.cache["ExtraCPADistance"].Cast<Slider>().CurrentValue;
            var extraDelayBuffer = ObjectCache.menuCache.cache["ExtraPingBuffer"].Cast<Slider>().CurrentValue;

            while (posChecked < maxPosToCheck)
            {
                radiusIndex++;

                int curRadius = radiusIndex * (2 * posRadius);
                int curCircleChecks = (int)Math.Ceiling((2 * Math.PI * (double)curRadius) / (2 * (double)posRadius));

                for (int i = 1; i < curCircleChecks; i++)
                {
                    posChecked++;
                    var cRadians = (2 * Math.PI / (curCircleChecks - 1)) * i; //check decimals
                    var pos = new Vector2((float)Math.Floor(heroPoint.X + curRadius * Math.Cos(cRadians)), (float)Math.Floor(heroPoint.Y + curRadius * Math.Sin(cRadians)));

                    //if (pos.Distance(myHero.Position.To2D()) < 100)
                    //    dist = 0;

                    var posInfo = CanHeroWalkToPos(pos, ObjectCache.myHeroCache.moveSpeed, extraDelayBuffer + ObjectCache.gamePing, extraDist);
                    posInfo.isDangerousPos = pos.CheckDangerousPos(6) || CheckMovePath(pos);
                    posInfo.distanceToMouse = pos.GetPositionValue();
                    posInfo.hasExtraDistance = extraEvadeDistance > 0 ? pos.HasExtraAvoidDistance(extraEvadeDistance) : false;

                    posTable.Add(posInfo);
                }
            }

            var sortedPosTable =
                posTable.OrderBy(p => p.isDangerousPos)
                        .ThenBy(p => p.posDangerLevel)
                        .ThenBy(p => p.hasExtraDistance)
                        .ThenBy(p => p.distanceToMouse);
            //.ThenBy(p => p.intersectionTime);

            foreach (var posInfo in sortedPosTable)
            {
                if (CheckPathCollision(myHero, posInfo.position) == false)
                    return posInfo;
            }
            return null;
        }
开发者ID:CONANLXF,项目名称:AIO,代码行数:56,代码来源:EvadeHelper.cs

示例2: GetBestPositionMovementBlock

        public static PositionInfo GetBestPositionMovementBlock(Vector2 movePos)
        {
            int posChecked = 0;
            int maxPosToCheck = 50;
            int posRadius = 50;
            int radiusIndex = 0;

            var extraEvadeDistance = ConfigValue.ExtraSpellRadius.GetInt();

            Vector2 heroPoint = GameData.HeroInfo.ServerPos2D;
            Vector2 lastMovePos = movePos;//Game.CursorPos.To2D(); //movePos

            List<PositionInfo> posTable = new List<PositionInfo>();

            var extraDist = ConfigValue.ExtraCpaDistance.GetInt();
            var extraDelayBuffer = Config.Properties.GetInt(ConfigValue.ExtraPingBuffer);

            while (posChecked < maxPosToCheck)
            {
                radiusIndex++;

                int curRadius = radiusIndex * (2 * posRadius);
                int curCircleChecks = (int)Math.Ceiling((2 * Math.PI * (double)curRadius) / (2 * (double)posRadius));

                for (int i = 1; i < curCircleChecks; i++)
                {
                    posChecked++;
                    var cRadians = (2 * Math.PI / (curCircleChecks - 1)) * i; //check decimals
                    var pos = new Vector2((float)Math.Floor(heroPoint.X + curRadius * Math.Cos(cRadians)), (float)Math.Floor(heroPoint.Y + curRadius * Math.Sin(cRadians)));

                    //if (pos.Distance(myHero.Position.To2D()) < 100)
                    //    dist = 0;

                    var posInfo = CanHeroWalkToPos(pos, GameData.HeroInfo.MoveSpeed, extraDelayBuffer + Game.Ping, extraDist);
                    posInfo.IsDangerousPos = pos.CheckDangerousPos(6) || CheckMovePath(pos);
                    posInfo.DistanceToMouse = pos.GetPositionValue();
                    posInfo.HasExtraDistance = extraEvadeDistance > 0 ? pos.HasExtraAvoidDistance(extraEvadeDistance) : false;

                    posTable.Add(posInfo);
                }
            }

            var sortedPosTable =
                posTable.OrderBy(p => p.IsDangerousPos)
                        .ThenBy(p => p.PosDangerLevel)
                        .ThenBy(p => p.HasExtraDistance)
                        .ThenBy(p => p.DistanceToMouse);
            //.ThenBy(p => p.intersectionTime);

            foreach (var posInfo in sortedPosTable)
            {
                if (CheckPathCollision(MyHero, posInfo.Position) == true)
                    return posInfo;
            }
            return null;
        }
开发者ID:coman3,项目名称:EloBuddy.Addons,代码行数:56,代码来源:EvadeHelper.cs


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