Ejemplo n.º 1
0
 public static bool Init(MakeMissileTarget mmt)
 {
     if (instance)
     {
         return(true);
     }
     if (!WorldRigidbodiesContainer)
     {
         return(false);
     }
     instance     = worldRigidbodiesContainer.gameObject.AddComponent <AAMissileFiredProbe>();
     instance.mmt = mmt;
     return(true);
 }
Ejemplo n.º 2
0
 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);
         }
     }
 }
Ejemplo n.º 3
0
 private void OnDisable() => instance = null;