public void Control(GameWorld gameWorld, Spacecraft me)
        {
            Infinity.debugString += "  " + targetId;
            var aiIdentifiableObjectInfos = gameWorld.GetIdentifiableObjects();

            var target = FindTarget(aiIdentifiableObjectInfos, me);

            if (target == null)
            {
                return;
            }
            targetId       = target.GameObjectId;
            facingOpponent = facingOpponent = MyMath.MovingTowards(target.Position, me.GamePosition, oldVelocity, 0.6f);;

            //if (me.Energy < 20) plan = 2;
            turnVelocityLimit = 10f;
            moveVelocityLimit = 60f;
            if (plan == 1)
            {
                MoveTowardsAndAttack(me, target, aiIdentifiableObjectInfos);
                if (facingOpponent &&
                    MyMath.Distance(target.Position, me.GamePosition) < 600 &&
                    MyMath.Random.NextDouble() < .4f)
                {
                    me.FireBullet();
                }
                if (MyMath.Distance(me.GamePosition, target.Position) < 50 + MyMath.Random.Next(50))
                {
                    plan = 2;
                }
            }
            else
            {
                MoveAwayFrom(me, target);
                if (MyMath.Distance(me.GamePosition, target.Position) > 200 &&
                    MyMath.Random.NextDouble() < .1f)
                {
                    plan = 1;
                }
            }

            //if (MyMath.Random.NextDouble() < .01f) plan = plan%2 +1;
        }
        private AiIdentifiableObjectInfo AnotherTargetAttackingMe(List <AiIdentifiableObjectInfo> list, AiIdentifiableObjectInfo identityInfo, Spacecraft spacecraft)
        {
            AiIdentifiableObjectInfo target = null;

            if (identityInfo.GameObjectId != spacecraft.GameObjectId &&
                identityInfo.GameObjectType == GameObjectType.Bullet &&
                MyMath.Distance(identityInfo.Position, spacecraft.GamePosition) < 100 &&
                MyMath.MovingTowards(spacecraft.GamePosition, identityInfo.Position, identityInfo.Velocity, 0.7f))
            {
                if (!enimity.ContainsKey(identityInfo.GameObjectId))
                {
                    enimity[identityInfo.GameObjectId] = 0;
                }
                enimity[identityInfo.GameObjectId] += 10;
                if (enimity[identityInfo.GameObjectId] > targetEnimity)
                {
                    AiIdentifiableObjectInfo identityInfo1 = identityInfo;
                    target        = list.Find(info => info.GameObjectId == identityInfo1.GameObjectId);
                    targetEnimity = enimity[identityInfo.GameObjectId];
                }
            }
            return(target);
        }