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


C# Vector3.IsValid方法代码示例

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


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

示例1: AngleBetween

 public static float AngleBetween(Vector3 oldPosition, Vector3 newPosition)
 {
     if (oldPosition.IsValid() && newPosition.IsValid())
     {
         return
             (oldPosition - ObjectManager.Player.Position).To2D()
                 .AngleBetween((newPosition - ObjectManager.Player.Position).To2D());
     }
     return 0f;
 }
开发者ID:aikoy,项目名称:LeagueSharp-Dev,代码行数:10,代码来源:Helpers.cs

示例2: Use

        public override bool Use(Vector3 position)
        {
            if (position.IsValid())
            {
                throw new ArgumentNullException(nameof(position));
            }

            Log.Debug($"UseAbility {this.Instance.Name} @ {position}");
            this.Instance.UseAbility(position);
            return true;
        }
开发者ID:EnsageSharp,项目名称:Ensage.Common,代码行数:11,代码来源:SkillshotAbility.cs

示例3: CastFlash

 public static void CastFlash(Vector3 position)
 {
     if (States.Flash != null && position.IsValid() && States.Flash.IsReady)
     {
         Player.CastSpell(States.Flash.Slot, position);
         Remove("FL");
     }
     else
     {
         Remove("FL");
     }
 }
开发者ID:MrClownYes,项目名称:mrclownhu3lozilla,代码行数:12,代码来源:Queuer.cs

示例4: GetFirstWallPoint

        public Vector3 GetFirstWallPoint(Vector3 start, Vector3 end, float range)
        {
            if (end.IsValid() && start.Distance(end) <= range)
            {
                var newPoint = start.Extend(end, range);

                return NavMesh.GetCollisionFlags(newPoint) == CollisionFlags.Wall || newPoint.IsWall()
                           ? newPoint
                           : Vector3.Zero;
            }
            return Vector3.Zero;
        }
开发者ID:Nechrito,项目名称:Leaguesharp,代码行数:12,代码来源:GnarWallDetection.cs

示例5: CastFlash

 public static void CastFlash(Vector3 position)
 {
     var flash = Player.Spells.FirstOrDefault(a => a.SData.Name == "summonerflash");
     if (flash != null && position.IsValid() && flash.IsReady)
     {
         Player.CastSpell(flash.Slot, position);
         Remove("FL");
     }
     else
     {
         Remove("FL");
     }
 }
开发者ID:h4ntero,项目名称:Elobuddy-Addons,代码行数:13,代码来源:Queuer.cs

示例6: Randomize

        public static Vector3 Randomize(this CryptoRandom rnd, Vector3 position, int amount)
        {
            if (position.IsValid())
            {
                if (amount > 0)
                {
                    amount = rnd.Next((int) Math.Floor(amount * 0.9f), (int) Math.Ceiling(amount * 1.1f));
                    position.X += rnd.Next(0, amount * 2 + 1) - amount;
                    position.Y += rnd.Next(0, amount * 2 + 1) - amount;
                }

                position.X = Truncate((int) position.X + (float) rnd.NextDouble(), 3);
                position.Y = Truncate((int) position.Y + (float) rnd.NextDouble(), 3);
                position.Z = NavMesh.GetHeightForPosition(position.X, position.Y);
            }

            return position;
        }
开发者ID:aikoy,项目名称:LeagueSharp-Dev,代码行数:18,代码来源:Helpers.cs

示例7: IsSharpTurn

 public static bool IsSharpTurn(Vector3 position, int minAngle)
 {
     if (position.IsValid())
     {
         var currentPath = ObjectManager.Player.GetWaypoints();
         if (currentPath.Count > 1 && currentPath.PathLength() > 100)
         {
             var movePath = ObjectManager.Player.GetPath(position);
             if (movePath.Length > 1)
             {
                 var angle = (currentPath[1] - currentPath[0]).AngleBetween((movePath[1] - movePath[0]).To2D());
                 var distance = movePath.Last().To2D().Distance(currentPath.Last(), true);
                 return !(angle < 10 && distance < 500 * 500 || distance < 50 * 50) && angle > minAngle;
             }
         }
     }
     return false;
 }
开发者ID:aikoy,项目名称:LeagueSharp-Dev,代码行数:18,代码来源:Helpers.cs

示例8: AccumulateCorrection

        public override void AccumulateCorrection(ref Vector3 correction, ref float weight)
        {
            if (Parent.Speed < 0.01f)
                return;

            var characterBotEntity = Parent.BotEntity as MyCharacter; // remove me pls
            if (characterBotEntity == null)
                return;

            var position = Parent.PositionAndOrientation.Translation;
            BoundingBoxD box = new BoundingBoxD(position - Vector3D.One * 3, position + Vector3D.One * 3);
            Vector3D currentMovement = Parent.ForwardVector;

            var entities = MyEntities.GetEntitiesInAABB(ref box);
            foreach (var entity in entities)
            {
                var character = entity as MyCharacter;
                if (character == null || character == characterBotEntity)
                    continue;
                if (character.ModelName == characterBotEntity.ModelName) // remove me pls
                    continue;

                Vector3D characterPos = character.PositionComp.GetPosition();
                Vector3D dir = characterPos - position;
                double dist = dir.Normalize();
                dist = MathHelper.Clamp(dist, 0, 6);
                var cos = Vector3D.Dot(dir, currentMovement);

                var opposite = -dir;
                if (cos > -0.807)
                    correction += (6f - dist) * Weight * opposite;

                if (!correction.IsValid())
                {
                    System.Diagnostics.Debugger.Break();
                }

            }
            entities.Clear();
            weight += Weight;
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:41,代码来源:MyCharacterAvoidance.cs

示例9: PointsAroundTheTarget

        public static List<Vector3> PointsAroundTheTarget(Vector3 pos, float dist, float prec = 15, float prec2 = 6)
        {
            if (!pos.IsValid())
            {
                return new List<Vector3>();
            }
            var list = new List<Vector3>();
            if (dist > 205)
            {
                prec = 30;
                prec2 = 8;
            }
            if (dist > 805)
            {
                dist = (float) (dist*1.5);
                prec = 45;
                prec2 = 10;
            }
            var angle = 360/prec*Math.PI/180.0f;
            var step = dist*2/prec2;
            for (var i = 0; i < prec; i++)
            {
                for (var j = 0; j < 6; j++)
                {
                    list.Add(
                        new Vector3(
                            pos.X + (float) (Math.Cos(angle*i)*(j*step)),
                            pos.Y + (float) (Math.Sin(angle*i)*(j*step)) - 90, pos.Z));
                }
            }

            return list;
        }
开发者ID:Xelamats,项目名称:PortAIO,代码行数:33,代码来源:CombatHelper.cs

示例10: PointsAroundTheTargetOuterRing

        public static List<Vector3> PointsAroundTheTargetOuterRing(Vector3 pos, float dist, float width = 15)
        {
            if (!pos.IsValid())
            {
                return new List<Vector3>();
            }
            var list = new List<Vector3>();
            var max = 2*dist/2*Math.PI/width/2;
            var angle = 360f/max*Math.PI/180.0f;
            for (var i = 0; i < max; i++)
            {
                list.Add(
                    new Vector3(
                        pos.X + (float) (Math.Cos(angle*i)*dist), pos.Y + (float) (Math.Sin(angle*i)*dist),
                        pos.Z));
            }

            return list;
        }
开发者ID:Xelamats,项目名称:PortAIO,代码行数:19,代码来源:CombatHelper.cs

示例11: GetAngle

 public static double GetAngle(Obj_AI_Base source, Vector3 target)
 {
     if (source == null || !target.IsValid())
     {
         return 0;
     }
     return source.Direction.LSTo2D().LSPerpendicular().LSAngleBetween((target - source.Position).LSTo2D());
     ;
 }
开发者ID:Xelamats,项目名称:PortAIO,代码行数:9,代码来源:CombatHelper.cs

示例12: IsFacing

 public static bool IsFacing(Obj_AI_Base source, Vector3 target, float angle = 90)
 {
     if (source == null || !target.IsValid())
     {
         return false;
     }
     return
         (double)
             source.Direction.LSTo2D().LSPerpendicular().LSAngleBetween((target - source.Position).LSTo2D()) <
         angle;
 }
开发者ID:Xelamats,项目名称:PortAIO,代码行数:11,代码来源:CombatHelper.cs

示例13: CheckQusage

 private bool CheckQusage(Vector3 pos, Obj_AI_Hero target)
 {
     return pos.IsValid() && pos.Distance(player.Position) < Q.Range &&
            (target.HasBuff("fiorapassivemanager") || target.HasBuff("fiorarmark")) && !pos.IsWall() &&
            Qradius > pos.Distance(target.Position);
 }
开发者ID:uio25371555,项目名称:LeagueSharp-4,代码行数:6,代码来源:Fiora.cs

示例14: IsFacing

        public static bool IsFacing(this Vector3 source, Vector3 target)
        {
            if (!source.IsValid() || !target.IsValid())
            {
                return false;
            }

            const float angle = 90;
            return source.To2D().AngleBetween((target - source).To2D()) < angle;
        }
开发者ID:ramonstro2323,项目名称:FARepo,代码行数:10,代码来源:JumpHandler.cs

示例15: GetMultiHit

 private static Tuple<AIHeroClient, int, Vector3> GetMultiHit(bool checkKill, int minHit, int mode)
 {
     var bestHit = 0;
     AIHeroClient bestTarget = null;
     var bestPos = new Vector3();
     var targetKicks =
         GameObjects.EnemyHeroes
             //TargetSelector(R.Range + (mode == 2 ? 500 : 0), R.DamageType)
             .Where(
                 i =>
                 i.LSIsValidTarget(R.Range + (mode == 2 ? 500 : 0)) &&
                 (mode != 2
                  || i.DistanceToPlayer() < R.Range + (WardManager.WardRange - Insec.GetDistance(i) - 80))
                 && i.Health + i.AttackShield > R.GetDamage(i) && !i.HasBuffOfType(BuffType.SpellShield)
                 && !i.HasBuffOfType(BuffType.SpellImmunity))
             .OrderByDescending(i => i.AllShield)
             .ToList();
     foreach (var targetKick in targetKicks)
     {
         var posTarget = mode == 1 ? targetKick.ServerPosition : R.GetPredPosition(targetKick, true);
         R2.UpdateSourcePosition(posTarget, posTarget);
         R2.Width = targetKick.BoundingRadius;
         var targetHits =
             GameObjects.EnemyHeroes.Where(
                 i => !i.Compare(targetKick) && i.IsValidTarget(R2.Range + R2.Width / 2, true, R2.From))
                 .OrderByDescending(i => new Priority().GetDefaultPriority(i))
                 .ToList();
         var posEnd = new Vector3();
         if (mode == 0)
         {
             var pos = R2.From.LSExtend(Player.ServerPosition, -R2.Range);
             targetHits = targetHits.Where(i => R2.WillHit(i, pos, 0, R2.MinHitChance)).ToList();
             if (checkKill && targetHits.Any(i => i.Health + i.AttackShield <= GetRColDmg(targetKick, i)))
             {
                 return new Tuple<AIHeroClient, int, Vector3>(targetKick, -1, posEnd);
             }
         }
         else
         {
             R2.Delay = R.Delay + (mode == 2 ? 0.05f : 0);
             var hits = new List<AIHeroClient>();
             foreach (var targetHit in targetHits)
             {
                 var list = new List<AIHeroClient>();
                 var pred = R2.GetPrediction(targetHit);
                 var pos = new Vector3();
                 if (pred.Hitchance >= R2.MinHitChance)
                 {
                     list.Add(targetHit);
                     list.AddRange(
                         targetHits.Where(
                             i => !i.Compare(targetHit) && R2.WillHit(i, pred.CastPosition, 0, R2.MinHitChance)));
                     pos = mode == 1
                               ? pred.CastPosition
                               : pred.Input.From.LSExtend(pred.CastPosition, -Insec.GetDistance(targetKick));
                 }
                 if (!pos.IsValid())
                 {
                     continue;
                 }
                 if (checkKill && list.Any(i => i.Health + i.AttackShield <= GetRColDmg(targetKick, i)))
                 {
                     return new Tuple<AIHeroClient, int, Vector3>(targetKick, -1, pos);
                 }
                 if (list.Count > hits.Count)
                 {
                     hits = list;
                     posEnd = pos;
                 }
             }
             targetHits = hits;
         }
         if (targetHits.Count > bestHit)
         {
             bestTarget = targetKick;
             bestHit = targetHits.Count;
             bestPos = posEnd;
         }
     }
     return new Tuple<AIHeroClient, int, Vector3>(bestTarget, bestHit >= minHit ? 1 : 0, bestPos);
 }
开发者ID:yashine59fr,项目名称:PortAIO-1,代码行数:81,代码来源:LeeSin.cs


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