Exemple #1
0
    public static ShuttleStaticSerializer SaveStaticData()
    {
        ShuttleStaticSerializer s3 = new ShuttleStaticSerializer();

        s3.shuttlesList = new List <ShuttleSerializer>();
        s3.haveShuttles = false;
        if (shuttlesList != null && shuttlesList.Count > 0)
        {
            int i = 0;
            while (i < shuttlesList.Count)
            {
                if (shuttlesList[i] == null)
                {
                    shuttlesList.RemoveAt(i);
                    continue;
                }
                else
                {
                    s3.shuttlesList.Add(shuttlesList[i].Save());
                    i++;
                }
            }
            if (s3.shuttlesList.Count > 0)
            {
                s3.haveShuttles = true;
            }
        }
        s3.lastIndex = lastIndex;
        return(s3);
    }
Exemple #2
0
 public static void LoadStaticData(ShuttleStaticSerializer s3)
 {
     lastIndex    = s3.lastIndex;
     shuttlesList = new List <Shuttle>();
     if (s3.haveShuttles)
     {
         foreach (ShuttleSerializer ss in s3.shuttlesList)
         {
             Shuttle s = Instantiate(Resources.Load <GameObject>("Prefs/shuttle")).GetComponent <Shuttle>();
             s.Load(ss);
             shuttlesList.Add(s);
         }
     }
 }