Example #1
0
        public Data_PlayerInfo GetClosestEnemy()
        {
            Single          distance = Single.MaxValue;
            Data_PlayerInfo closest  = EnemyTeamData.FirstOrDefault();

            foreach (Data_PlayerInfo enemy in EnemyTeamData)
            {
                if (enemy.IsDead || (enemy.Shield > 4 && distance != Single.MaxValue))
                {
                    continue;
                }
                Single newDistance = Vector3.Distance(LocalPlayer.ID.ToGame().Position(), enemy.ID.ToGame().Position());
                if (newDistance < distance)
                {
                    distance = newDistance;
                    closest  = enemy;
                }
            }
            return(closest);
        }
Example #2
0
 public Boolean InDanger(Data_PlayerInfo player)
 {
     foreach (ActiveObject current in ViewState.ActiveObjects.Values)
     {
         if (LocalPlayer.Team == current.Team)
         {
             continue;
         }
         Vector2 StartPosition = current.ObjectId.Get("StartPosition");
         if (StartPosition == default(GameValue))
         {
             Vector2 TargetsHit = current.ObjectId.Get("TargetsHit");
             if (TargetsHit == default(GameValue))
             {
                 continue;
             }
             var owner          = ((GameObjectId)current.ObjectId.Get("Owner"));
             var attackingEnemy = EnemyTeamData.FirstOrDefault(t => t.ID.ToGame() == owner);
             if (Vector3.Distance(LocalPlayer.ID.ToGame().Position(), attackingEnemy.ID.ToGame().Position()) < 2.5f)
             {
                 return(true);
             }
         }
         Vector2 Direction   = current.ObjectId.Get("Direction");
         Single  Range       = current.ObjectId.Get("Range");
         Single  Thickness   = current.ObjectId.Get("SpellCollisionRadius");
         Vector2 EndPosition = StartPosition + Direction.Normalized * Range;
         Boolean intersect   =
             MathCore.GeometryMath.CircleVsThickLine(
                 new Vector2(player.ID.ToGame().Position().x, player.ID.ToGame().Position().z), 0.6f,
                 StartPosition, EndPosition, Thickness, true);
         if (intersect)
         {
             return(true);
         }
     }
     return(false);
 }