Exemple #1
0
 public bool IsExpired()
 {
     if (Missile == null)
     {
         return(true);
     }
     if (Target == null)
     {
         return(true);
     }
     if (Missile.MarkedForClose)
     {
         _onExplode(Missile);
         return(true);
     }
     if (TrackedFrames > _deathTimer)
     {
         Missile.Close();
         return(true);
     }
     if (Target.MarkedForClose)
     {
         // Log.Info("Target is marked for close, searching new one");
         if (Target.GetTopMostParent().MarkedForClose)
         {
             return(true);
         }
         IMyEntity newTarget = GuidedMissileTargetGridHook.GetRandomBlockInGrid(Target);
         if (newTarget == null)
         {
             return(true);
         }
         Target                = newTarget;
         _isOvershooting       = false;
         _overshootDistance    = 0f;
         _finishedOvershooting = false;
         return(false);
         //  return true;
     }
     return(false);
 }