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


C# Spell.GetSpellEndPosition方法代码示例

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


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

示例1: InSkillShot

        public static bool InSkillShot(this Vector2 position, Spell spell, float radius, bool predictCollision = true)
        {
            if (spell.spellType == SpellType.Line)
            {
                Vector2 spellPos = spell.currentSpellPosition;
                Vector2 spellEndPos = predictCollision ? spell.GetSpellEndPosition() : spell.endPos;

                //spellPos = spellPos - spell.direction * radius; //leave some space at back of spell
                //spellEndPos = spellEndPos + spell.direction * radius; //leave some space at the front of spell

                /*if (spell.info.projectileSpeed == float.MaxValue
                    && Evade.GetTickCount - spell.startTime > spell.info.spellDelay)
                {
                    return false;
                }*/

                var projection = position.ProjectOn(spellPos, spellEndPos);

                /*if (projection.SegmentPoint.Distance(spellEndPos) < 100) //Check Skillshot endpoints
                {
                    //unfinished
                }*/

                return projection.IsOnSegment && projection.SegmentPoint.Distance(position) <= spell.radius + radius;
            }
            else if (spell.spellType == SpellType.Circular)
            {
                if (spell.info.spellName == "VeigarEventHorizon")
                {
                    return position.Distance(spell.endPos) <= spell.radius + radius - ObjectCache.myHeroCache.boundingRadius
                        && position.Distance(spell.endPos) >= spell.radius + radius - ObjectCache.myHeroCache.boundingRadius - 125;
                }

                return position.Distance(spell.endPos) <= spell.radius + radius - ObjectCache.myHeroCache.boundingRadius;
            }
            else if (spell.spellType == SpellType.Arc)
            {
                if (position.isLeftOfLineSegment(spell.startPos, spell.endPos))
                {
                    return false;
                }

                var spellRange = spell.startPos.Distance(spell.endPos);
                var midPoint = spell.startPos + spell.direction * (spellRange/2);

                return position.Distance(midPoint) <= spell.radius + radius - ObjectCache.myHeroCache.boundingRadius;
            }
            else if (spell.spellType == SpellType.Cone)
            {

            }
            return false;
        }
开发者ID:aikoy,项目名称:ezEvade,代码行数:53,代码来源:Position.cs

示例2: CanHeroWalkIntoSpell

        public static bool CanHeroWalkIntoSpell(Spell spell)
        {
            if (ObjectCache.menuCache.cache["AdvancedSpellDetection"].Cast<CheckBox>().CurrentValue)
            {
                Vector2 heroPos = myHero.Position.LSTo2D();
                var extraDist = myHero.LSDistance(ObjectCache.myHeroCache.serverPos2D);

                if (spell.spellType == SpellType.Line)
                {
                    var walkRadius = ObjectCache.myHeroCache.moveSpeed * (spell.endTime - EvadeUtils.TickCount) / 1000 + ObjectCache.myHeroCache.boundingRadius + spell.info.radius + extraDist + 10;
                    var spellPos = spell.currentSpellPosition;
                    var spellEndPos = spell.GetSpellEndPosition();

                    var projection = heroPos.LSProjectOn(spellPos, spellEndPos);

                    return projection.SegmentPoint.LSDistance(heroPos) <= walkRadius;
                }
                else if (spell.spellType == SpellType.Circular)
                {
                    var walkRadius = ObjectCache.myHeroCache.moveSpeed * (spell.endTime - EvadeUtils.TickCount) / 1000 + ObjectCache.myHeroCache.boundingRadius + spell.info.radius + extraDist + 10;

                    if (heroPos.LSDistance(spell.endPos) < walkRadius)
                    {
                        return true;
                    }

                }
                else if (spell.spellType == SpellType.Arc)
                {
                    var spellRange = spell.startPos.LSDistance(spell.endPos);
                    var midPoint = spell.startPos + spell.direction * (spellRange / 2);
                    var arcRadius = spell.info.radius * (1 + spellRange / 100);

                    var walkRadius = ObjectCache.myHeroCache.moveSpeed * (spell.endTime - EvadeUtils.TickCount) / 1000 + ObjectCache.myHeroCache.boundingRadius + arcRadius + extraDist + 10;

                    if (heroPos.LSDistance(midPoint) < walkRadius)
                    {
                        return true;
                    }

                }

                return false;
            }

            return true;
        }
开发者ID:yashine59fr,项目名称:PortAIO-1,代码行数:47,代码来源:SpellDetector.cs

示例3: GetClosestDistanceApproach

        public static float GetClosestDistanceApproach(Spell spell, Vector2 pos, float speed, float delay, Vector2 heroPos, float extraDist)
        {
            var walkDir = (pos - heroPos).Normalized();

            if (spell.spellType == SpellType.Line && spell.info.projectileSpeed != float.MaxValue)
            {
                var spellPos = spell.GetCurrentSpellPosition(true, delay);
                var spellStartPos = spell.currentSpellPosition;
                var spellEndPos = spell.GetSpellEndPosition();
                var extendedPos = pos.ExtendDir(walkDir, ObjectCache.myHeroCache.boundingRadius + speed * delay / 1000);

                Vector2 cHeroPos;
                Vector2 cSpellPos;

                var cpa2 = MathUtils.GetCollisionDistanceEx(
                    heroPos, walkDir * speed, ObjectCache.myHeroCache.boundingRadius,
                    spellPos, spell.direction * spell.info.projectileSpeed, spell.radius + extraDist,
                    out cHeroPos, out cSpellPos);

                var cHeroPosProjection = cHeroPos.ProjectOn(heroPos, extendedPos);
                var cSpellPosProjection = cSpellPos.ProjectOn(spellPos, spellEndPos);

                if (cSpellPosProjection.IsOnSegment && cHeroPosProjection.IsOnSegment && cpa2 != float.MaxValue)
                {
                    return 0;
                }

                var cpa = MathUtilsCPA.CPAPointsEx(heroPos, walkDir * speed, spellPos, spell.direction * spell.info.projectileSpeed, pos, spellEndPos, out cHeroPos, out cSpellPos);

                cHeroPosProjection = cHeroPos.ProjectOn(heroPos, extendedPos);
                cSpellPosProjection = cSpellPos.ProjectOn(spellPos, spellEndPos);

                var checkDist = ObjectCache.myHeroCache.boundingRadius + spell.radius + extraDist;

                if (cSpellPosProjection.IsOnSegment && cHeroPosProjection.IsOnSegment)
                {
                    return Math.Max(0, cpa - checkDist);
                }
                else
                {
                    return checkDist;
                }

                //return MathUtils.ClosestTimeOfApproach(heroPos, walkDir * speed, spellPos, spell.direction * spell.info.projectileSpeed);
            }
            else if (spell.spellType == SpellType.Line && spell.info.projectileSpeed == float.MaxValue)
            {
                var spellHitTime = Math.Max(0, spell.endTime - EvadeUtils.TickCount - delay);  //extraDelay
                var walkRange = heroPos.Distance(pos);
                var predictedRange = speed * (spellHitTime / 1000);
                var tHeroPos = heroPos + walkDir * Math.Min(predictedRange, walkRange); //Hero predicted pos

                var projection = tHeroPos.ProjectOn(spell.startPos, spell.endPos);

                return Math.Max(0, tHeroPos.Distance(projection.SegmentPoint)
                    - (spell.radius + ObjectCache.myHeroCache.boundingRadius + extraDist)); //+ dodgeBuffer
            }
            else if (spell.spellType == SpellType.Circular)
            {
                var spellHitTime = Math.Max(0, spell.endTime - EvadeUtils.TickCount - delay);  //extraDelay
                var walkRange = heroPos.Distance(pos);
                var predictedRange = speed * (spellHitTime / 1000);
                var tHeroPos = heroPos + walkDir * Math.Min(predictedRange, walkRange); //Hero predicted pos

                if (spell.info.spellName == "VeigarEventHorizon")
                {
                    var wallRadius = 65;
                    var midRadius = spell.radius - wallRadius;

                    if (spellHitTime == 0)
                    {
                        return 0;
                    }

                    if (tHeroPos.Distance(spell.endPos) >= spell.radius)
                    {
                        return Math.Max(0, tHeroPos.Distance(spell.endPos) - midRadius - wallRadius);
                    }
                    else
                    {
                        return Math.Max(0, midRadius - tHeroPos.Distance(spell.endPos) - wallRadius);
                    }
                }

                var closestDist = Math.Max(0, tHeroPos.Distance(spell.endPos) - (spell.radius + extraDist));
                if (spell.info.extraEndTime > 0 && closestDist != 0)
                {
                    var remainingTime = Math.Max(0, spell.endTime + spell.info.extraEndTime - EvadeUtils.TickCount - delay);
                    var predictedRange2 = speed * (remainingTime / 1000);
                    var tHeroPos2 = heroPos + walkDir * Math.Min(predictedRange2, walkRange);

                    if (CheckMoveToDirection(tHeroPos, tHeroPos2))
                    {
                        return 0;
                    }
                }
                else
                {
                    return closestDist;
                }
//.........这里部分代码省略.........
开发者ID:salesprendes,项目名称:LeagueSharp,代码行数:101,代码来源:EvadeHelper.cs

示例4: GetClosestDistanceApproach

        public static float GetClosestDistanceApproach(Spell spell, Vector2 pos, float speed, float delay, Vector2 heroPos, float extraDist)
        {
            var walkDir = (pos - heroPos).Normalized();
            var zVector = new Vector2(0, 0);

            heroPos = heroPos - walkDir * speed * ((float)ObjectCache.gamePing) / 1000;

            if (spell.info.spellType == SpellType.Line && spell.info.projectileSpeed != float.MaxValue)
            {
                var spellPos = spell.GetCurrentSpellPosition(true, delay);
                var spellEndPos = spell.GetSpellEndPosition();

                Vector2 cSpellPos;
                Vector2 cHeroPos;
                var cpa = MathUtilsCPA.CPAPointsEx(heroPos, walkDir * speed, spellPos, spell.direction * spell.info.projectileSpeed, pos, spellEndPos, out cSpellPos, out cHeroPos);

                var spellPos2 = spell.currentNegativePosition;

                Vector2 cSpellPos2;
                Vector2 cHeroPos2;
                var cpa2 = MathUtilsCPA.CPAPointsEx(heroPos, walkDir * speed, spellPos2, spell.direction * spell.info.projectileSpeed, pos, spellEndPos, out cSpellPos2, out cHeroPos2);

                var cHeroPosProjection = cHeroPos.ProjectOn(cSpellPos2, cSpellPos); //from predicted

                var checkDist = ObjectCache.myHeroCache.boundingRadius + spell.radius + extraDist;

                if (cHeroPosProjection.IsOnSegment)
                {
                    if (cHeroPosProjection.SegmentPoint.Distance(cHeroPos) <= checkDist)
                    {
                        return 0;
                    }
                }

                if (cpa <= checkDist || cpa2 <= checkDist)
                {
                    return 0;
                }

                return Math.Min(Math.Max(0, cpa - checkDist), Math.Max(0, cpa2 - checkDist));

                //return MathUtils.ClosestTimeOfApproach(heroPos, walkDir * speed, spellPos, spell.direction * spell.info.projectileSpeed);
            }
            else if (spell.info.spellType == SpellType.Line && spell.info.projectileSpeed == float.MaxValue)
            {
                var spellHitTime = Math.Max(0, spell.endTime - EvadeUtils.TickCount - delay);  //extraDelay
                var walkRange = heroPos.Distance(pos);
                var predictedRange = speed * (spellHitTime / 1000);
                var tHeroPos = heroPos + walkDir * Math.Min(predictedRange, walkRange); //Hero predicted pos

                var projection = tHeroPos.ProjectOn(spell.startPos, spell.endPos);

                return Math.Max(0, tHeroPos.Distance(projection.SegmentPoint)
                    - (spell.radius + ObjectCache.myHeroCache.boundingRadius + extraDist)); //+ dodgeBuffer
            }
            else if (spell.info.spellType == SpellType.Circular)
            {
                var spellHitTime = Math.Max(0, spell.endTime - EvadeUtils.TickCount - delay);  //extraDelay
                var walkRange = heroPos.Distance(pos);
                var predictedRange = speed * (spellHitTime / 1000);
                var tHeroPos = heroPos + walkDir * Math.Min(predictedRange, walkRange); //Hero predicted pos

                return Math.Max(0, tHeroPos.Distance(spell.endPos) - (spell.radius + extraDist)); //+ dodgeBuffer
            }

            return 1;
        }
开发者ID:xQxCPMxQx,项目名称:LeagueSharp-5,代码行数:67,代码来源:EvadeHelper.cs

示例5: InSkillShot

        public static bool InSkillShot(this Vector2 position, Spell spell, float radius, bool predictCollision = true)
        {
            if (spell.info.spellType == SpellType.Line)
            {
                Vector2 spellPos = spell.currentSpellPosition; //leave little space at back of skillshot
                Vector2 spellEndPos = predictCollision ? spell.GetSpellEndPosition() : spell.endPos;

                /*if (spell.info.projectileSpeed == float.MaxValue
                    && Evade.GetTickCount - spell.startTime > spell.info.spellDelay)
                {
                    return false;
                }*/

                var projection = position.ProjectOn(spellPos, spellEndPos);

                /*if (projection.SegmentPoint.Distance(spellEndPos) < 100) //Check Skillshot endpoints
                {
                    //unfinished
                }*/

                return projection.SegmentPoint.Distance(position) <= spell.radius + radius;
            }
            else if (spell.info.spellType == SpellType.Circular)
            {
                return position.Distance(spell.endPos) <= spell.radius + radius - ObjectCache.myHeroCache.boundingRadius;
            }
            else if (spell.info.spellType == SpellType.Cone)
            {

            }
            return false;
        }
开发者ID:xQxCPMxQx,项目名称:LeagueSharp-5,代码行数:32,代码来源:Position.cs

示例6: CanHeroWalkIntoSpell

        public static bool CanHeroWalkIntoSpell(Spell spell)
        {
            if (ObjectCache.menuCache.cache["AdvancedSpellDetection"].GetValue<bool>())
            {
                Vector2 heroPos = myHero.Position.To2D();
                var extraDist = myHero.Distance(ObjectCache.myHeroCache.serverPos2D);

                if (spell.info.spellType == SpellType.Line)
                {
                    var walkRadius = ObjectCache.myHeroCache.moveSpeed * (spell.endTime - EvadeUtils.TickCount) / 1000 + ObjectCache.myHeroCache.boundingRadius + spell.info.radius + extraDist + 10;
                    var spellPos = spell.currentSpellPosition;
                    var spellEndPos = spell.GetSpellEndPosition();

                    var projection = heroPos.ProjectOn(spellPos, spellEndPos);

                    return projection.SegmentPoint.Distance(heroPos) <= walkRadius;
                }
                else if (spell.info.spellType == SpellType.Circular)
                {
                    var walkRadius = ObjectCache.myHeroCache.moveSpeed * (spell.endTime - EvadeUtils.TickCount) / 1000 + ObjectCache.myHeroCache.boundingRadius + spell.info.radius + extraDist + 10;

                    if (heroPos.Distance(spell.endPos) < walkRadius)
                    {
                        return true;
                    }

                }

                return false;
            }

            return true;
        }
开发者ID:bongy97,项目名称:LeagueSharp-1,代码行数:33,代码来源:SpellDetector.cs


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