Example #1
0
 internal void addItem(GameObject itemToAdd)
 {
     if (itemToAdd.GetComponent <SAMSiteController>() != null)
     {
         samSites.Add(itemToAdd);
         foreach (GameObject radar in trackingRadars)
         {
             radar.GetComponent <RadarController>().connectSamSite(itemToAdd.GetComponent <SAMSiteController>());
         }
     }
     else if (itemToAdd.GetComponent <MissileLauncherController>() != null)
     {
         missileLaunchers.Add(itemToAdd);
     }
     else if (itemToAdd.GetComponent <RadarController>() != null)
     {
         trackingRadars.Add(itemToAdd);
         RadarController radarController = itemToAdd.GetComponent <RadarController>();
         foreach (GameObject samSite in samSites)
         {
             radarController.connectSamSite(samSite.GetComponent <SAMSiteController>());
         }
     }
     else if (itemToAdd.GetComponent <MissileController>() != null)
     {
         missilesOnAir.Add(itemToAdd);
     }
     else
     {
         Debug.LogError("Couldn't add the item into any list: " + itemToAdd.name);
     }
 }