Example #1
0
    private void CreateNewUnit()
    {
        UnitInfo u = new UnitInfo(100, 5, 10, 1, "The first unit's name");

        u.name = "Hunter";
        UnitList ul = new UnitList("main");

        ul.Add(u);
        XMLDataSerializer.SaveUnits(ul, "Assets/Data/Units.xml");
    }
Example #2
0
    //Save the Unit Library to file.
    public int Save_Units_To_File()
    {
        int      count = 0;
        UnitList list  = new UnitList("main");

        foreach (KeyValuePair <string, UnitInfo> u in Library_Unit)
        {
            list.unitList.Add(u.Value);
            ++count;
        }
        XMLDataSerializer.SaveUnits(list, _Library_Units_Path);
        Debug.Log("Saving " + count + " units to file.");
        return(count);
    }