public void Save(ShipConfigurationManager shipConfigManager)
    {
        TextWriter tw = new StreamWriter(fileName);
        foreach (ShipConfiguration config in shipConfigManager.shipConfigurations)
        {
            tw.WriteLine(config.configurationName);
            tw.WriteLine(config.shipID);
            foreach (ShipComponentSlot slot in config.shipComponentSlots)
            {
                tw.Write(slot.componentID.ToString() + " ");
            }
            tw.WriteLine();
        }

        tw.Close();
    }
    public void Load(ShipConfigurationManager shipConfigManager)
    {
        TextReader tr;

        //error loading file
        if ((tr = new StreamReader(fileName)) == null)
        {
            return;
        }

        UnitList unitList = GameObject.Find("_Lists").GetComponent<UnitList>();
        ShipComponentList componentList = GameObject.Find("_Lists").GetComponent<ShipComponentList>();
        while (tr.Peek() != -1)
        {
            ShipConfiguration config = new ShipConfiguration();

            string line = tr.ReadLine();
            config.configurationName = line;

            line = tr.ReadLine();
            Ship ship = unitList.GetShipByID(int.Parse(line));
            if (ship != null)
            {
                config.SetShip(ship);

                line = tr.ReadLine();
                string[] components = line.Split(' ');
                for (int i = 0; i < config.shipComponentSlots.Count; i++)
                {
                    config.shipComponentSlots[i].shipComponent = componentList.GetComponentByID(int.Parse(components[i]));
                }

                shipConfigManager.shipConfigurations.Add(config);
            }
            else
            {
                Debug.Log("Error cannot find ship id: " + line);
            }
        }

        tr.Close();
    }
 public AIObjectiveBuildFleet(CampaignStation station)
 {
     this.station = station;
     shipConfigurationManager = GameObject.Find("ShipConfigurationManager").GetComponent<ShipConfigurationManager>();
 }