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


C# Vector2.IsValid方法代码示例

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


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

示例1: IsCondemable

        public static bool IsCondemable(this AIHeroClient unit, Vector2 pos = new Vector2())
        {
            if (unit.HasBuffOfType(BuffType.SpellImmunity) || unit.HasBuffOfType(BuffType.SpellShield) || LastCheck + 50 > Environment.TickCount || _Player.IsDashing()) return false;
            var prediction = ESpell.GetPrediction(unit);
            var predictionsList = pos.IsValid() ? new List<Vector3>() {pos.To3D()} :  new List<Vector3>
                        {
                            unit.ServerPosition,
                            unit.Position,
                            prediction.CastPosition,
                            prediction.UnitPosition
                        };

            var wallsFound = 0;
            Program.Points = new List<Vector2>();
            foreach (var position in predictionsList)
            {
                for (var i = 0; i < Program.CondemnMenu["pushDistance"].Cast<Slider>().CurrentValue; i += (int) unit.BoundingRadius)
                {
                    var cPos = _Player.Position.Extend(position, _Player.Distance(position) + i).To3D();
                    Program.Points.Add(cPos.To2D());
                    if (NavMesh.GetCollisionFlags(cPos).HasFlag(CollisionFlags.Wall) ||
                            NavMesh.GetCollisionFlags(cPos).HasFlag(CollisionFlags.Building))
                    {
                        wallsFound++;
                        break;
                    }
                }
            }
            if ((wallsFound/ predictionsList.Count) >= Program.CondemnMenu["condemnPercent"].Cast<Slider>().CurrentValue/100f)
            {
                return true;
            }
            
            return false;
        }
开发者ID:Remzooorro,项目名称:Elobuddy-Addons,代码行数:35,代码来源:Condemn.cs

示例2: FoundIntersection

 public FoundIntersection(float distance, int time, Vector2 point, Vector2 comingFrom)
 {
     this.Distance = distance;
     this.ComingFrom = comingFrom;
     this.Valid = point.IsValid();
     this.Point = point + Config.GridSize * (this.ComingFrom - point).LSNormalized();
     this.Time = time;
 }
开发者ID:CONANLXF,项目名称:AIO,代码行数:8,代码来源:Skillshot.cs

示例3: FoundIntersection

 public FoundIntersection(float distance, int time, Vector2 point, Vector2 comingFrom)
 {
     Distance = distance;
     ComingFrom = comingFrom;
     Valid = point.IsValid();
     Point = point + Config.GridSize * (ComingFrom - point).Normalized();
     Time = time;
 }
开发者ID:hieuseu1,项目名称:LeagueSharp-1,代码行数:8,代码来源:Skillshot.cs

示例4: FoundIntersection

 public FoundIntersection(float distance, int time, Vector2 pointVector2, Vector2 comingFromVector2)
 {
     Distance = distance;
     ComingFromVector2 = comingFromVector2;
     IsValid = pointVector2.IsValid();
     PointVector2 = pointVector2 + GridSize * (ComingFromVector2 - pointVector2).Normalized();
     Time = time;
 }
开发者ID:mrarticuno,项目名称:EBHQ,代码行数:8,代码来源:Skillshot.cs

示例5: GetTarget

 public static AIHeroClient GetTarget(float range, DamageType type, Vector2 secondaryPos = new Vector2())
 {
     if (_target == null || _target.IsDead || _target.Health <= 0 || !_target.IsValidTarget())
         _target = null;
     if (secondaryPos.IsValid() && _target.Distance(secondaryPos) < range || _target.IsValidTarget(range))
     {
         return _target;
     }
     return TargetSelector.GetTarget(range, type);
 }
开发者ID:FireBuddy,项目名称:zilean,代码行数:10,代码来源:TargetSelector2.cs

示例6: GetTarget

 public static AIHeroClient GetTarget(float range, DamageType type, Vector2 secondaryPos = new Vector2())
 {
     if (_target == null || _target.IsDead || _target.Health <= 0 || !_target.IsValidTarget())
         _target = null;
     var hasBuffTristE = Player.Instance.HasBuff("tristanaecharge");
     if (secondaryPos.IsValid() && _target.Distance(secondaryPos) < range || _target.IsValidTarget(range) || hasBuffTristE)
     {
         return _target;
     }
     return TargetSelector.GetTarget(range, type);
 }
开发者ID:0s0speedy,项目名称:Hu3Series,代码行数:11,代码来源:TargetSelector.cs

示例7: Cast

        private bool Cast(Vector2 position, Obj_AI_Base target)
        {
            Console.WriteLine("cast equest");
            switch (Type)
            {
                    case ActiveSpellType.Item:
                        if (Items.CanUseItem(ItemId))
                        {
                            if (position.IsValid() && ObjectManager.Player.Distance(position, true) < Range * Range)
                            {
                                Items.UseItem(ItemId, position);
                            }
                            else if (target.IsValidTarget(Range, false))
                            {
                                Items.UseItem(ItemId, target);
                            }

                            return true;
                        }
                        return false;

                    case ActiveSpellType.Spell:
                        if (position.IsValid() && ObjectManager.Player.Distance(position, true) < Range * Range)
                        {
                            return ObjectManager.Player.Spellbook.CastSpell(Slot, position.To3D());
                        }
                        if (target.IsValidTarget(Range, false))
                        {
                            return ObjectManager.Player.Spellbook.CastSpell(Slot, target);
                        }
                        return false;
                    case ActiveSpellType.SummonerSpell:
                        var slot = ObjectManager.Player.GetSpellSlot(SummmonerSpellName);
                        if (slot != SpellSlot.Unknown)
                        {
                            if (position.IsValid() && ObjectManager.Player.Distance(position, true) < Range * Range)
                            {
                                return ObjectManager.Player.Spellbook.CastSpell(slot, position.To3D());
                            }
                            if (target.IsValidTarget(Range, false))
                            {
                                return ObjectManager.Player.Spellbook.CastSpell(slot);
                            }
                        }
                        return false;
            }

            return false;
        }
开发者ID:GitMiester,项目名称:L-Assemblies,代码行数:49,代码来源:ActiveSpell.cs

示例8: SetPosition

        public static void SetPosition(Vector2 position = new Vector2())
        {
            position = position.IsValid() ? position : Cursor.ScreenPosition;

            if (position == Vector2.Zero)
            {
                return;
            }

            if (Position.LSDistance(position) < 100)
            {
                CursorSprite.Position = position.GetRelativePosition();
            }

            //MouseManager.StartPath(position);
        }
开发者ID:CONANLXF,项目名称:AIO,代码行数:16,代码来源:VirtualCursor.cs

示例9: IsCondemable

        public static bool IsCondemable(this AIHeroClient unit, Vector2 pos = new Vector2())
        {
            if (unit.HasBuffOfType(BuffType.SpellImmunity) || unit.HasBuffOfType(BuffType.SpellShield) || LastCheck + 50 > Environment.TickCount || _Player.IsDashing()) return false;
            Program.CorrectPoints = new List<Vector2>();
            Program.Points = new List<Vector2>();
            if (!pos.IsValid()) pos = ObjectManager.Player.Position.To2D();
            int wallCount = 0;
            int pushDistance = Program.CondemnMenu["pushDistance"].Cast<Slider>().CurrentValue;

            for (int i = 0; i < pushDistance; i += 20)
            {
                var unitPos = Prediction.Position.PredictUnitPosition(unit, 250);
                var cell = pos.Extend(unitPos, unitPos.Distance(pos) + i);
                if (cell.ToNavMeshCell().CollFlags.HasFlag(CollisionFlags.Wall))
                {
                    Program.CorrectPoints.Add(cell);
                    wallCount++;
                }
                else
                {
                    Program.Points.Add(cell);
                }
            }

            if (CheckCount >= 2 && wallCount > 2)
            {
                CheckCount = 0;
                LastCheck = Environment.TickCount;
                return true;
            }

            if (wallCount > 2)
            {
                CheckCount++;
            }
            else
            {
                CheckCount = 0;
            }
            LastCheck = Environment.TickCount;
            return false;
        }
开发者ID:hup3s,项目名称:Elobuddy-Addons,代码行数:42,代码来源:Condemn.cs

示例10: Condemn360

        public static bool Condemn360(Obj_AI_Hero unit, int push, Vector2 pos = new Vector2())
        {
            if (unit.HasBuffOfType(BuffType.SpellImmunity) || unit.HasBuffOfType(BuffType.SpellShield) ||
                _lastCheck + 50 > Environment.TickCount || ObjectManager.Player.IsDashing())
            {
                return false;
            }

            var prediction = E.GetPrediction(unit);
            var predictionsList = pos.IsValid() ? new List<Vector3>() { pos.ToVector3() } : new List<Vector3>
                        {
                            unit.ServerPosition,
                            unit.Position,
                            prediction.CastPosition,
                            prediction.UnitPosition
                        };

            var wallsFound = 0;
            _points = new List<Vector2>();
            foreach (var position in predictionsList)
            {
                for (var i = 0; i < push; i += (int)unit.BoundingRadius) // 420 = push distance
                {
                    var cPos = ObjectManager.Player.Position.Extend(position, ObjectManager.Player.Distance(position) + i).ToVector2();
                    _points.Add(cPos);
                    if (NavMesh.GetCollisionFlags(cPos.ToVector3()).HasFlag(CollisionFlags.Wall) || NavMesh.GetCollisionFlags(cPos.ToVector3()).HasFlag(CollisionFlags.Building))
                    {
                        wallsFound++;
                        break;
                    }
                }
            }

            // ReSharper disable once PossibleLossOfFraction
            if ((wallsFound / predictionsList.Count) >= 33 / 100f)
            {
                return true;
            }

            return false;
        }
开发者ID:HikigayaAss,项目名称:LeagueSharpSDK,代码行数:41,代码来源:Condemn.cs

示例11: Condemn360

        public static void Condemn360(Obj_AI_Hero hero, Vector2 pos = new Vector2())
        {
            if (hero.HasBuffOfType(BuffType.SpellImmunity) || hero.HasBuffOfType(BuffType.SpellShield) ||
                LastCheck + 50 > Environment.TickCount || ObjectManager.Player.IsDashing())
            {
                return;
            }
            var prediction = VayneSpells.E.GetPrediction(hero);
            var predictionsList = pos.IsValid() ? new List<Vector3>() { pos.To3D() } : new List<Vector3>
                        {
                            hero.ServerPosition,
                            hero.Position,
                            prediction.CastPosition,
                            prediction.UnitPosition
                        };

            var wallsFound = 0;
            Points = new List<Vector2>();
            foreach (var position in predictionsList)
            {
                for (var i = 0; i < PushDistance; i += (int)hero.BoundingRadius) // 420 = push distance
                {
                    var cPos = ObjectManager.Player.Position.Extend(position, ObjectManager.Player.Distance(position) + i).To2D();
                    Points.Add(cPos);
                    if (NavMesh.GetCollisionFlags(cPos.To3D()).HasFlag(CollisionFlags.Wall) || NavMesh.GetCollisionFlags(cPos.To3D()).HasFlag(CollisionFlags.Building))
                    {
                        wallsFound++;
                        break;
                    }
                }
            }
            if ((wallsFound / predictionsList.Count) >= 33 / 100f)
            {
                VayneSpells.E.Cast(hero);
            }
        }
开发者ID:HikigayaAss,项目名称:hikiMarksman,代码行数:36,代码来源:VayneHelper.cs

示例12: threeSixty

        public static bool threeSixty(AIHeroClient unit, Vector2 pos = new Vector2())
        {
            if (unit.HasBuffOfType(BuffType.SpellImmunity) || unit.HasBuffOfType(BuffType.SpellShield) || ObjectManager.Player.LSIsDashing())
                return false;
            var prediction = E.GetPrediction(unit);
            var predictionsList = pos.IsValid() ? new List<Vector3> { pos.To3D() } : new List<Vector3> { unit.ServerPosition, unit.Position, prediction.CastPosition, prediction.UnitPosition };
            var wallsFound = 0;
            Points = new List<Vector2>();
            foreach (var position in predictionsList)
            {
                for (var i = 0; i < getSliderItem(emenu, "PushDistance"); i += (int)unit.BoundingRadius) // 420 = push distance
                {
                    var cPos = ObjectManager.Player.Position.LSExtend(position, ObjectManager.Player.LSDistance(position) + i);
                    Points.Add(cPos.LSTo2D());
                    if (NavMesh.GetCollisionFlags(cPos).HasFlag(CollisionFlags.Wall) || NavMesh.GetCollisionFlags(cPos).HasFlag(CollisionFlags.Building))
                    {
                        wallsFound++;
                        break;
                    }
                }
            }
            if (wallsFound / predictionsList.Count >= 33 / 100f)
            {
                return true;
            }

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

示例13: OnDetectSkillshot


//.........这里部分代码省略.........
                 (int)(skillshot.SpellData.Delay + d1 * 1000f / skillshot.SpellData.MissileSpeed + 500);
             bounce2SpellData.Delay =
                 (int)(bounce1SpellData.Delay + d2 * 1000f / bounce1SpellData.MissileSpeed + 500);
             DetectedSkillshots.Add(
                 new Skillshot(
                     skillshot.DetectionType,
                     bounce1SpellData,
                     skillshot.StartTick,
                     skillshot.End,
                     bounce1Pos,
                     skillshot.Unit));
             DetectedSkillshots.Add(
                 new Skillshot(
                     skillshot.DetectionType,
                     bounce2SpellData,
                     skillshot.StartTick,
                     bounce1Pos,
                     bounce2Pos,
                     skillshot.Unit));
         }
         if (skillshot.SpellData.SpellName == "ZiggsR")
         {
             skillshot.SpellData.Delay =
                 (int)(1500 + 1500 * skillshot.End.Distance(skillshot.Start) / skillshot.SpellData.Range);
         }
         if (skillshot.SpellData.SpellName == "JarvanIVDragonStrike")
         {
             var endPos = new Vector2();
             foreach (var s in
                 DetectedSkillshots.Where(i => i.SpellData.Slot == SpellSlot.E))
             {
                 if (!s.Unit.Compare(skillshot.Unit))
                 {
                     continue;
                 }
                 var extendedE = new Skillshot(
                     skillshot.DetectionType,
                     skillshot.SpellData,
                     skillshot.StartTick,
                     skillshot.Start,
                     skillshot.End + skillshot.Direction * 100,
                     skillshot.Unit);
                 if (!extendedE.IsSafePoint(s.End))
                 {
                     endPos = s.End;
                 }
                 break;
             }
             foreach (var m in
                 GameObjects.Minions.Where(i => i.CharData.BaseSkinName == "jarvanivstandard"))
             {
                 if (m.Team != skillshot.Unit.Team)
                 {
                     continue;
                 }
                 var extendedE = new Skillshot(
                     skillshot.DetectionType,
                     skillshot.SpellData,
                     skillshot.StartTick,
                     skillshot.Start,
                     skillshot.End + skillshot.Direction * 100,
                     skillshot.Unit);
                 if (!extendedE.IsSafePoint(m.Position.ToVector2()))
                 {
                     endPos = m.Position.ToVector2();
                 }
                 break;
             }
             if (endPos.IsValid())
             {
                 skillshot = new Skillshot(
                     DetectionType.ProcessSpell,
                     SpellDatabase.GetByName("JarvanIVEQ"),
                     Variables.TickCount,
                     skillshot.Start,
                     endPos + 200 * (endPos - skillshot.Start).Normalized(),
                     skillshot.Unit);
             }
         }
     }
     if (skillshot.SpellData.SpellName == "OriannasQ")
     {
         DetectedSkillshots.Add(
             new Skillshot(
                 skillshot.DetectionType,
                 SpellDatabase.GetByName("OriannaQend"),
                 skillshot.StartTick,
                 skillshot.Start,
                 skillshot.End,
                 skillshot.Unit));
     }
     if ((skillshot.SpellData.DisableFowDetection
          || Program.MainMenu["Evade"][skillshot.SpellData.ChampionName.ToLowerInvariant()][
              skillshot.SpellData.SpellName]["DisableFoW"].GetValue<MenuBool>().Value)
         && skillshot.DetectionType == DetectionType.RecvPacket)
     {
         return;
     }
     DetectedSkillshots.Add(skillshot);
 }
开发者ID:seniseviy,项目名称:LeagueSharp-6,代码行数:101,代码来源:Evade.cs

示例14: OnDetectSkillshot


//.........这里部分代码省略.........
                        var d2 = d1 * 0.4f;
                        var d3 = d2 * 0.69f;
                        var bounce1SpellData = SpellDatabase.GetByName("ZiggsQBounce1");
                        var bounce2SpellData = SpellDatabase.GetByName("ZiggsQBounce2");
                        var bounce1Pos = skillshot.End + skillshot.Direction * d2;
                        var bounce2Pos = bounce1Pos + skillshot.Direction * d3;
                        bounce1SpellData.Delay =
                            (int)(skillshot.SpellData.Delay + d1 * 1000f / skillshot.SpellData.MissileSpeed + 500);
                        bounce2SpellData.Delay =
                            (int)(bounce1SpellData.Delay + d2 * 1000f / bounce1SpellData.MissileSpeed + 500);
                        SkillshotDetector.DetectedSkillshots.Add(
                            new Skillshot(
                                skillshot.DetectionType,
                                bounce1SpellData,
                                skillshot.StartTick,
                                skillshot.End,
                                bounce1Pos,
                                skillshot.Unit));
                        SkillshotDetector.DetectedSkillshots.Add(
                            new Skillshot(
                                skillshot.DetectionType,
                                bounce2SpellData,
                                skillshot.StartTick,
                                bounce1Pos,
                                bounce2Pos,
                                skillshot.Unit));
                    }
                    if (skillshot.SpellData.SpellName == "ZiggsR")
                    {
                        skillshot.SpellData.Delay =
                            (int)(1500 + 1500 * skillshot.End.Distance(skillshot.Start) / skillshot.SpellData.Range);
                    }
                    if (skillshot.SpellData.SpellName == "JarvanIVDragonStrike")
                    {
                        var endPos = new Vector2();
                        foreach (var s in SkillshotDetector.DetectedSkillshots)
                        {
                            if (s.Unit.NetworkId == skillshot.Unit.NetworkId && s.SpellData.Slot == SpellSlot.E)
                            {
                                var extendedE = new Skillshot(
                                    skillshot.DetectionType,
                                    skillshot.SpellData,
                                    skillshot.StartTick,
                                    skillshot.Start,
                                    skillshot.End + skillshot.Direction * 100,
                                    skillshot.Unit);
                                if (!extendedE.IsSafePoint(s.End))
                                {
                                    endPos = s.End;
                                }
                                break;
                            }
                        }
                        foreach (var m in ObjectManager.Get<Obj_AI_Minion>())
                        {
                            if (m.CharData.BaseSkinName == "jarvanivstandard" && m.Team == skillshot.Unit.Team)
                            {
                                var extendedE = new Skillshot(
                                    skillshot.DetectionType,
                                    skillshot.SpellData,
                                    skillshot.StartTick,
                                    skillshot.Start,
                                    skillshot.End + skillshot.Direction * 100,
                                    skillshot.Unit);
                                if (!extendedE.IsSafePoint(m.Position.To2D()))
                                {
                                    endPos = m.Position.To2D();
                                }
                                break;
                            }
                        }
                        if (endPos.IsValid())
                        {
                            skillshot = new Skillshot(
                                DetectionType.ProcessSpell,
                                SpellDatabase.GetByName("JarvanIVEQ"),
                                Utils.GameTimeTickCount,
                                skillshot.Start,
                                endPos + 200 * (endPos - skillshot.Start).Normalized(),
                                skillshot.Unit);
                        }
                    }
                }
                if (skillshot.SpellData.SpellName == "OriannasQ")
                {
                    SkillshotDetector.DetectedSkillshots.Add(
                        new Skillshot(
                            skillshot.DetectionType,
                            SpellDatabase.GetByName("OriannaQend"),
                            skillshot.StartTick,
                            skillshot.Start,
                            skillshot.End,
                            skillshot.Unit));
                }
                if (skillshot.SpellData.DisableFowDetection && skillshot.DetectionType == DetectionType.RecvPacket)
                {
                    return;
                }
                SkillshotDetector.DetectedSkillshots.Add(skillshot);
            }
开发者ID:Kysamaa,项目名称:Developing,代码行数:101,代码来源:EvadeManager.cs

示例15: LockROnTarget

 private static void LockROnTarget()
 {
     var target = R.GetTarget();
     if (target == null)
     {
         return;
     }
     var endPos = (Player.ServerPosition - target.ServerPosition).Normalized();
     var predPos = R.GetPrediction(target).CastPosition.To2D();
     var fullPoint = new Vector2(predPos.X + endPos.X * R.Range * 0.98f, predPos.Y + endPos.Y * R.Range * 0.98f);
     var closestPoint = Player.ServerPosition.To2D().Closest(new List<Vector2> { predPos, fullPoint });
     if (closestPoint.IsValid() && !closestPoint.IsWall() && predPos.Distance(closestPoint) > E.Range)
     {
         Player.IssueOrder(GameObjectOrder.MoveTo, closestPoint.To3D());
     }
     else if (fullPoint.IsValid() && !fullPoint.IsWall() && predPos.Distance(fullPoint) < R.Range &&
              predPos.Distance(fullPoint) > 100)
     {
         Player.IssueOrder(GameObjectOrder.MoveTo, fullPoint.To3D());
     }
 }
开发者ID:pandaChoi,项目名称:LeagueSharp-3,代码行数:21,代码来源:Lucian.cs


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