static void LoadGameController()
    {
        string directoryPath = Application.persistentDataPath + "/" + fileSlot;

        if (File.Exists(directoryPath + "/GameController.save"))
        {
            GCData          loadedController = new GCData();
            BinaryFormatter bf   = new BinaryFormatter();
            FileStream      file = File.Open(directoryPath + "/GameController.save", FileMode.Open);
            loadedController = (GCData)bf.Deserialize(file);
            file.Close();
            GameObject.Find("GameController").GetComponent <GameController>().LoadGameController(loadedController);
        }
        else
        {
            Debug.Log("No save file found for slot!");
        }
    }
Пример #2
0
 private void Free <T>(ref T obj, bool finalize)
     where T : class
 {
     if (_timer != null)
     {
         var data = new GCData(Interlocked.Exchange(ref obj, null), finalize);
         if (data.CanFree)
         {
             Monitor.Enter(_syncRoot);
             try
             {
                 _queue.Enqueue(data);
             }
             finally
             {
                 Monitor.Exit(_syncRoot);
             }
         }
     }
 }
 public void LoadGameController(GCData loadedData)
 {
     data = loadedData;
 }