Exemple #1
0
        public BloodGUI.Data_PlayerInfo GetClosestPlayer()
        {
            Single distance            = Single.MaxValue;
            var    _PlayersInfoBinding = (BloodGUI_Binding.HUD.UI_PlayersInfoBinding)hudBase.GetType().GetField("_PlayersInfoBinding", flags).GetValue(hudBase);
            var    _EnemyTeamData      = (List <BloodGUI.Data_PlayerInfo>)_PlayersInfoBinding.GetType().GetField("_EnemyTeamData", flags).GetValue(_PlayersInfoBinding);
            var    _LocalTeamData      = (List <BloodGUI.Data_PlayerInfo>)_PlayersInfoBinding.GetType().GetField("_LocalTeamData", flags).GetValue(_PlayersInfoBinding);
            var    LocalPlayer         = _LocalTeamData.Find(p => p.LocalPlayer);

            BloodGUI.Data_PlayerInfo closest = LocalPlayer;
            foreach (var enemy in _EnemyTeamData)
            {
                if (enemy.IsDead)
                {
                    continue;
                }
                var newDistance = Vector3.Distance(LocalPlayer.Position(), enemy.Position());
                if (newDistance < distance)
                {
                    distance = newDistance;
                    closest  = enemy;
                }
            }
            foreach (var player in _LocalTeamData)
            {
                if (player.IsDead)
                {
                    continue;
                }
                var newDistance = Vector3.Distance(LocalPlayer.Position(), player.Position());
                if (newDistance < distance)
                {
                    distance = newDistance;
                    closest  = player;
                }
            }
            return(closest);
        }
Exemple #2
0
        public BloodGUI.Data_PlayerInfo GetClosestEnemy()
        {
            Single distance = Single.MaxValue;

            BloodGUI.Data_PlayerInfo closest = LocalPlayer;
            foreach (var enemy in _EnemyTeamData)
            {
                if (enemy.IsDead)
                {
                    continue;
                }
                if (enemy.Shield > 4)
                {
                    continue;
                }
                var newDistance = Vector3.Distance(LocalPlayer.Position(), enemy.Position());
                if (newDistance < distance)
                {
                    distance = newDistance;
                    closest  = enemy;
                }
            }
            return(closest);
        }
Exemple #3
0
 public static UnityEngine.Vector3 Position(this BloodGUI.Data_PlayerInfo playerInfo)
 {
     return(Loader.Controller.unityMain.GetObjectPosition(playerInfo.ID.ToGame()));
 }