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


C# Obj_AI_Base.GetDashInfo方法代码示例

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


在下文中一共展示了Obj_AI_Base.GetDashInfo方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
        {
            List<Vector2> path = target.GetWaypoints();
            if (from == null)
                from = ObjectManager.Player.ServerPosition.To2D();

            if (path.Count <= 1 || (target is Obj_AI_Hero && ((Obj_AI_Hero)target).IsChannelingImportantSpell()) || Utility.IsImmobileTarget(target))
                return target.ServerPosition.To2D();

            if (target.IsDashing())
                return target.GetDashInfo().Path.Last();

            float distance = distanceSet;

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

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

                    flyTime = targetDistance / Vr.Length();
                }

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

            for (int i = 0; i < path.Count - 1; i++)
            {
                float d = path[i + 1].Distance(path[i]);
                if (distance == d)
                    return path[i + 1];
                else if (distance < d)
                    return path[i] + distance * (path[i + 1] - path[i]).Normalized();
                else distance -= d;
            }

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

示例2: GetDashingPrediction

        /// <summary>
        /// Gets Predicted position while target is dashing
        /// </summary>
        private static Vector2 GetDashingPrediction(Obj_AI_Base target, Spell s, out HitChance hc, Vector3 rangeCheckFrom)
        {
            if (target.IsDashing())
            {
                var dashInfo = target.GetDashInfo();

                float dashPassedDistance = (Utils.TickCount - dashInfo.StartTick) / 1000f * dashInfo.Speed;
                Vector2 currentDashPos = dashInfo.StartPos + (dashInfo.EndPos - dashInfo.StartPos).Normalized() * dashPassedDistance;

                float targetDistance = rangeCheckFrom.To2D().Distance(currentDashPos);
                float flyTime = 0f;

                if (s.Speed != 0) //skillshot with a missile
                {
                    Vector2 Vt = (dashInfo.Path[dashInfo.Path.Count - 1] - dashInfo.Path[0]).Normalized() * dashInfo.Speed;
                    Vector2 Vs = (target.ServerPosition.To2D() - rangeCheckFrom.To2D()).Normalized() * s.Speed;
                    Vector2 Vr = Vs - Vt;

                    flyTime = targetDistance / Vr.Length();
                }
                int dashLeftTime = dashInfo.EndTick - Utils.TickCount;
                float t = flyTime + s.Delay + Game.Ping / 1000f;

                if (dashLeftTime >= t * 1000f)
                {
                    float distance = t * dashInfo.Speed;
                    hc = HitChance.Dashing;

                    for (int i = 0; i < dashInfo.Path.Count - 1; i++)
                    {
                        float d = dashInfo.Path[i + 1].Distance(dashInfo.Path[i]);
                        if (distance == d)
                            return dashInfo.Path[i + 1];
                        else if (distance < d)
                            return dashInfo.Path[i] + distance * (dashInfo.Path[i + 1] - dashInfo.Path[i]).Normalized();
                        else distance -= d;
                    }
                }
            }

            hc = HitChance.Impossible;
            return rangeCheckFrom.To2D();
        }
开发者ID:47110572,项目名称:LeagueSharp,代码行数:46,代码来源:Prediction.cs

示例3: 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)
        {
            Result result = new Result();

            if (target.IsDashing())
            {
                var dashInfo = target.GetDashInfo();
                if (dashInfo.IsBlink)
                {
                    result.HitChance = HitChance.Impossible;
                    return result;
                }

                //define hitboxes
                var dashHitBox = ClipperWrapper.MakePaths(ClipperWrapper.DefineRectangle(dashInfo.StartPos, dashInfo.EndPos + (dashInfo.EndPos - dashInfo.StartPos).Normalized() * 500, target.BoundingRadius * 2));
                var myHitBox = ClipperWrapper.MakePaths(ClipperWrapper.DefineCircle(from, from == ObjectManager.Player.ServerPosition.To2D() ? ObjectManager.Player.BoundingRadius : width));

                if (ClipperWrapper.IsIntersects(myHitBox, dashHitBox))
                {
                    result.HitChance = HitChance.Dashing;
                    result.CastPosition = target.ServerPosition.To2D();
                    result.UnitPosition = result.CastPosition;
                    result.CollisionResult = Collision.GetCollisions(from, result.CastPosition, width, delay, missileSpeed);

                    //check collisions
                    if (collisionable && result.CollisionResult.Objects.HasFlag(Collision.Flags.Minions))
                        result.HitChance = HitChance.Collision;

                    return result;
                }

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

                //check range
                if (result.CastPosition.Distance(from) > range)
                    result.HitChance = HitChance.OutOfRange;

                //check collisions
                if (collisionable && (result.CollisionResult.Objects.HasFlag(Collision.Flags.Minions) || result.CollisionResult.Objects.HasFlag(Collision.Flags.YasuoWall)))
                    result.HitChance = HitChance.Collision;
            }
            else
                result.HitChance = HitChance.Impossible;
            return result;
        }
开发者ID:MrWenzoxfs,项目名称:elobuddy,代码行数:58,代码来源:Prediction.cs

示例4: GetFastUnitPosition

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

            if (moveSpeed == 0)
                moveSpeed = target.MoveSpeed;

            if (path.Count <= 1 || (target is Obj_AI_Hero && ((Obj_AI_Hero)target).IsChannelingImportantSpell()) || Utility.IsImmobileTarget(target))
                return target.ServerPosition.To2D();

            if (target.IsDashing())
                return target.GetDashInfo().Path.Last();

            float distance = distanceSet;

            if (distance == 0)
            {
                float targetDistance = from.Value.Distance(target.ServerPosition);
                float flyTime = 0f;

                if (missileSpeed != 0) //skillshot with a missile
                {
                    Vector2 Vt = (path[path.Count - 1] - path[0]).Normalized() * moveSpeed;
                    Vector2 Vs = (target.ServerPosition.To2D() - from.Value).Normalized() * missileSpeed;
                    Vector2 Vr = Vs - Vt;

                    flyTime = targetDistance / Vr.Length();

                    if (path.Count > 5) //complicated movement
                        flyTime = targetDistance / missileSpeed;
                }

                float t = flyTime + delay + Game.Ping / 2000f + SpellDelay / 1000f;
                distance = t * moveSpeed;
            }

            for (int i = 0; i < path.Count - 1; i++)
            {
                float d = path[i + 1].Distance(path[i]);
                if (distance == d)
                    return path[i + 1];
                else if (distance < d)
                    return path[i] + distance * (path[i + 1] - path[i]).Normalized();
                else distance -= d;
            }

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

示例5: GetPredictedPos

        private Vector2 GetPredictedPos(Obj_AI_Base target, Vector3 rangeCheckFrom, float width, float time)
        {
            List<Vector2> path = target.GetWaypoints();
            if (path.Count <= 1) //if target is not moving, easy to hit
                return target.ServerPosition.To2D();

            if (target is Obj_AI_Hero)
            {
                if (((Obj_AI_Hero)target).IsChannelingImportantSpell())
                    return target.ServerPosition.To2D();
            }

            if (SPrediction.Prediction.IsImmobileTarget(target))
                return target.ServerPosition.To2D();

            if (target.IsDashing())
                return target.GetDashInfo().Path.Last();

            float targetDistance = rangeCheckFrom.Distance(target.ServerPosition);
            float flyTimeMin = 0f;
            float flyTimeMax = 0f;

            float tMin = flyTimeMin + 0.75f + Game.Ping / 2000f;
            float tMax = flyTimeMax + 0.75f + Game.Ping / 1000f;
            float pathTime = 0f;
            int[] x = new int[] { -1, -1 };

            for (int i = 0; i < path.Count - 1; i++)
            {
                float t = path[i + 1].Distance(path[i]) / target.MoveSpeed;

                if (pathTime <= tMin && pathTime + t >= tMin)
                    x[0] = i;
                if (pathTime <= tMax && pathTime + t >= tMax)
                    x[1] = i;

                if (x[0] != -1 && x[1] != -1)
                    break;

                pathTime += t;
            }

            if (x[0] != -1 && x[1] != -1)
            {
                for (int k = x[0]; k <= x[1]; k++)
                {
                    Vector2 direction = (path[k + 1] - path[k]).Normalized();
                    float distance = width;
                    int steps = (int)Math.Floor(path[k].Distance(path[k + 1]) / distance);
                    for (int i = 0; i < steps; i++)
                    {
                        Vector2 pA = path[k] + (direction * distance * i);
                        Vector2 pB = path[k] + (direction * distance * (i + 1));
                        Vector2 center = (pA + pB) / 2f;

                        float t = time + Game.Ping / 2000f;

                        float arriveTimeA = target.ServerPosition.To2D().Distance(pA) / target.MoveSpeed;
                        float arriveTimeB = target.ServerPosition.To2D().Distance(pB) / target.MoveSpeed;

                        if (Math.Min(arriveTimeA, arriveTimeB) <= t && Math.Max(arriveTimeA, arriveTimeB) >= t)
                            return center;
                    }

                    if (steps == 0)
                        return path[x[1]];
                }
            }

            return Vector2.Zero;
        }
开发者ID:fgpmaia123,项目名称:Leaguesharp-31,代码行数:71,代码来源:Orianna.cs

示例6: 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)
        {
            Result result = new Result();
            result.Input = new Input(target, delay, missileSpeed, width, range, collisionable, type, from.To3D2(), rangeCheckFrom.To3D2());
            result.Unit = target;

            if (target.IsDashing())
            {
                var dashInfo = target.GetDashInfo();
                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:ShineSharp,项目名称:LeagueSharp,代码行数:40,代码来源:Prediction.cs

示例7: GetBadaoPrediction

        public static PredictionOutput GetBadaoPrediction(this Spell spell, Obj_AI_Base target, bool collideyasuowall = true)
        {
            PredictionOutput result = null;

            if (!target.IsValidTarget(float.MaxValue, false))
            {
                return new PredictionOutput();
            }
            if (target.IsDashing())
            {
                var dashDtata = target.GetDashInfo();
                result = spell.GetBadaoStandarPrediction(target,
                    new List<Vector2>() { target.ServerPosition.ToVector2(), dashDtata.Path.Last() }, dashDtata.Speed);
                if (result.Hitchance >= HitChance.High)
                    result.Hitchance = HitChance.Dashing;
            }
            else
            {
                //Unit is immobile.
                var remainingImmobileT = UnitIsImmobileUntil(target);
                if (remainingImmobileT >= 0d)
                {
                    var timeToReachTargetPosition = spell.Delay + target.Position.ToVector2().Distance(spell.From.ToVector2()) / spell.Speed;
                    if (spell.RangeCheckFrom.ToVector2().Distance(target.Position.ToVector2()) <= spell.Range)
                    {
                        if (timeToReachTargetPosition <=
                            remainingImmobileT + (target.BoundingRadius + spell.Width - 40) / target.MoveSpeed)
                        {
                            result = new PredictionOutput
                            {
                                CastPosition = target.ServerPosition,
                                UnitPosition = target.ServerPosition,
                                Hitchance = HitChance.Immobile
                            };
                        }

                        else result = new PredictionOutput
                        {
                            CastPosition = target.ServerPosition,
                            UnitPosition = target.ServerPosition,
                            Hitchance = HitChance.High
                            /*timeToReachTargetPosition - remainingImmobileT + input.RealRadius / input.Unit.MoveSpeed < 0.4d ? HitChance.High : HitChance.Medium*/
                        };
                    }
                    else
                    {
                        result = new PredictionOutput();
                    }
                }
            }
            //Normal prediction
            if (result == null)
            {
                result = spell.GetBadaoStandarPrediction(target, target.GetWaypoints());
            }
            //Check for collision
            if (spell.Collision)
            {
                var positions = new List<Vector3> { result.UnitPosition, result.CastPosition, target.Position };
                var originalUnit = target;
                result.CollisionObjects = spell.GetCollision(positions);
                result.CollisionObjects.RemoveAll(x => x.NetworkId == originalUnit.NetworkId);
                result.Hitchance = result.CollisionObjects.Count > 0 ? HitChance.Collision : result.Hitchance;
            }
            //Check yasuo wall collision
            else if (collideyasuowall)
            {
                var positions = new List<Vector3> { result.UnitPosition, result.CastPosition, target.Position };
                var originalUnit = target;
                result.CollisionObjects = spell.GetCollision(positions);
                result.CollisionObjects.Any(x => x.NetworkId == ObjectManager.Player.NetworkId);
                result.Hitchance = result.CollisionObjects.Any(x => x.NetworkId == ObjectManager.Player.NetworkId) ? HitChance.Collision : result.Hitchance;
            }
            return result;
        }
开发者ID:badao,项目名称:BadaoAIO,代码行数:75,代码来源:BadaoPrediction.cs


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