public TargetManager2(IRadar radar)
 {
     this.radar          = radar;
     this.aircraftScript = radar.AircraftScript;
     aircraftScript.TargetingSystem.TargetAdded   += OnTargetAdded;
     aircraftScript.TargetingSystem.TargetRemoved += OnTargetRemoved;
 }
 void Awake()
 {
     if (!AAMissileFiredProbe.Init(this))
     {
         enabled = false;
         Destroy(this);
     }
     if (Aircraft.events.ContainsKey("AircraftGenerated"))
     {
         var        e      = Aircraft.events["AircraftGenerated"];
         MethodInfo method = GetType().GetMethod(nameof(AircraftGenerated));
         delAircraftGeneratred = Delegate.CreateDelegate(e.EventHandlerType, this, method, true);
         e.AddEventHandler(null, delAircraftGeneratred);
     }
     for (int i = 0; i < allAircraftScripts.Count; i++)
     {
         IAircraftScript a = allAircraftScripts[i];
         if (a == null)
         {
             allAircraftScripts.RemoveAt(i--);
         }
     }
     for (int i = 0; i < allAircraftScripts.Count; i++)
     {
         IAircraftScript a = allAircraftScripts[i];
         if (a == null)
         {
             allAircraftScripts.RemoveAt(i--);
         }
     }
     for (int i = 0; i < aircraftLaunchedMissiles.Count; i++)
     {
         var a = aircraftLaunchedMissiles.ElementAt(i);
         if (a.Value.missileScript == null)
         {
             aircraftLaunchedMissiles.Remove(a.Key);
         }
     }
     for (int i = 0; i < samLaunchedMissiles.Count; i++)
     {
         var a = samLaunchedMissiles.ElementAt(i);
         if (a.Value.missileScript == null)
         {
             samLaunchedMissiles.Remove(a.Key);
         }
     }
 }
 public void Register(IAircraftScript aircraft)
 {
     if (allAircraftScripts.Contains(aircraft))
     {
         return;
     }
     if (aircraftContructor == null)
     {
         aircraftContructor = aircraft.Aircraft.GetType().GetConstructor(new Type[] { typeof(XElement) });
     }
     allAircraftScripts.Add(aircraft);
     aircraft.TargetingSystem.MissileFired += OnMissleFired;
     for (int i = 0; i < allAircraftScripts.Count; i++)
     {
         IAircraftScript a = allAircraftScripts[i];
         if (a == null)
         {
             allAircraftScripts.RemoveAt(i--);
         }
     }
 }
 public SAMMissileInfo(IAircraftScript missileAircraftScript, MonoBehaviour missileScript)
 {
     this.missileAircraftScript = missileAircraftScript;
     this.missileScript         = missileScript;
     rigidbody = missileScript.GetComponent <Rigidbody>();
 }
 public MissileInfo(IAircraftScript missileAircraftScript, IMissileScript missileScript)
 {
     this.missileAircraftScript = missileAircraftScript;
     this.missileScript         = missileScript;
     rigidbody = ((IPartScript)((MonoBehaviour)missileScript).GetComponent(PartScript.type)).Body.RigidBody;
 }