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


C# Obj_AI_Base.LSGetDashInfo方法代码示例

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


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

示例1: GetFastUnitPosition

        /// <summary>
        ///     Gets fast-predicted unit position
        /// </summary>
        /// <param name="target">Target</param>
        /// <param name="delay">Spell delay</param>
        /// <param name="missileSpeed">Spell missile speed</param>
        /// <param name="from">Spell casted position</param>
        /// <returns></returns>
        public static Vector2 GetFastUnitPosition(Obj_AI_Base target, float delay, float missileSpeed = 0,
            Vector2? from = null, float distanceSet = 0)
        {
            var path = target.GetWaypoints();
            if (from == null)
                from = ObjectManager.Player.ServerPosition.LSTo2D();

            if (path.Count <= 1 || (target is AIHeroClient && target.Spellbook.IsChanneling) || Utility.IsImmobileTarget(target))
                return target.ServerPosition.LSTo2D();

            if (target.LSIsDashing())
                return target.LSGetDashInfo().Path.Last();

            var distance = distanceSet;

            if (distance == 0)
            {
                var targetDistance = from.Value.LSDistance(target.ServerPosition);
                var flyTime = targetDistance/missileSpeed;

                if (missileSpeed != 0 && path.Count == 2)
                {
                    var Vt = (path[1] - path[0]).LSNormalized()*target.MoveSpeed;
                    var Vs = (target.ServerPosition.LSTo2D() - from.Value).LSNormalized()*missileSpeed;
                    var Vr = Vt - Vs;

                    flyTime = targetDistance/Vr.Length();
                }

                var t = flyTime + delay + Game.Ping/2000f;
                distance = t*target.MoveSpeed;
            }

            for (var i = 0; i < path.Count - 1; i++)
            {
                var d = path[i + 1].LSDistance(path[i]);
                if (distance == d)
                    return path[i + 1];
                if (distance < d)
                    return path[i] + distance*(path[i + 1] - path[i]).LSNormalized();
                distance -= d;
            }

            return path.Last();
        }
开发者ID:Xelamats,项目名称:PortAIO,代码行数:53,代码来源:Prediction.cs

示例2: GetDashingPrediction

        /// <summary>
        ///     Gets Prediction result while unit is dashing
        /// </summary>
        /// <param name="target">Target for spell</param>
        /// <param name="width">Spell width</param>
        /// <param name="delay">Spell delay</param>
        /// <param name="missileSpeed">Spell missile speed</param>
        /// <param name="range">Spell range</param>
        /// <param name="collisionable">Spell collisionable</param>
        /// <param name="type">Spell skillshot type</param>
        /// <param name="from">Spell casted position</param>
        /// <returns></returns>
        internal static Result GetDashingPrediction(Obj_AI_Base target, float width, float delay, float missileSpeed,
            float range, bool collisionable, SkillshotType type, Vector2 from, Vector2 rangeCheckFrom)
        {
            var result = new Result
            {
                Input = new Input(target, delay, missileSpeed, width, range, collisionable, type, @from.To3D2(), rangeCheckFrom.To3D2()),
                Unit = target
            };

            if (target.LSIsDashing())
            {
                var dashInfo = target.LSGetDashInfo();
                if (dashInfo.IsBlink)
                {
                    result.HitChance = HitChance.Impossible;
                    result.CastPosition = dashInfo.EndPos;
                    return result;
                }

                result.CastPosition = GetFastUnitPosition(target, dashInfo.Path, delay, missileSpeed, from, dashInfo.Speed);
                result.HitChance = HitChance.Dashing;

                result.Lock(false);
            }
            else
            {
                result = GetPrediction(target, width, delay, missileSpeed, range, collisionable, type, target.GetWaypoints(), 0, 0, 0, 0, from, rangeCheckFrom);
                result.Lock(false);
            }
            return result;
        }
开发者ID:Xelamats,项目名称:PortAIO,代码行数:43,代码来源:Prediction.cs


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