public static void RemoveAttacker(MySmallShipBot attacker)
 {
     for (int i = 0; i < CurrentBotsAttackingPlayer.Count; i++)
     {
         var pair = CurrentBotsAttackingPlayer[i];
         if (pair.Value == attacker)
         {
             CurrentBotsAttackingPlayer.RemoveAt(i);
             break;
         }
     }
 }
        public static void AddAttacker(MySmallShipBot attacker, MyEntity target)
        {
            if (MySession.IsPlayerShip(target))
            {
                foreach (var pair in CurrentBotsAttackingPlayer)
                {
                    if (pair.Value == attacker)
                    {
                        return;
                    }
                }

                float attackerDistance = Vector3.Distance(MyCamera.Position, attacker.GetPosition());

                if (CurrentBotsAttackingPlayer.Count == MaxBotsAttackingPlayer)
                {
                    if (CurrentBotsAttackingPlayer[CurrentBotsAttackingPlayer.Count - 1].Key <= attackerDistance)
                    {
                        return;
                    }

                    for (int i = 0; i < CurrentBotsAttackingPlayer.Count; i++)
                    {
                        var pair = CurrentBotsAttackingPlayer[i];

                        if (attackerDistance < pair.Key)
                        {
                            CurrentBotsAttackingPlayer.RemoveAt(i);
                            break;
                        }
                    }
                }

                CurrentBotsAttackingPlayer.Add(new KeyValuePair <float, MySmallShipBot>(attackerDistance, attacker));
                CurrentBotsAttackingPlayer.Sort(Compare);
            }

            System.Diagnostics.Debug.Assert(CurrentBotsAttackingPlayer.Count <= MaxBotsAttackingPlayer);
        }