Пример #1
0
 public static void InitializeFromDefault()
 {
     if (_instance)
     {
         DestroyImmediate(_instance);
     }
     _instance           = Instantiate((AnimalInventory)Resources.Load("AnimalInventoryTemplate"));
     _instance.hideFlags = HideFlags.HideAndDontSave;
 }
Пример #2
0
 public static void LoadFromJSON(string path)
 {
     if (_instance)
     {
         DestroyImmediate(_instance);
     }
     _instance = ScriptableObject.CreateInstance <AnimalInventory>();
     JsonUtility.FromJsonOverwrite(System.IO.File.ReadAllText(path), _instance);
     _instance.hideFlags = HideFlags.HideAndDontSave;
 }
Пример #3
0
 public static void LoadOrInitializeAnimalInventory()
 {
     if (File.Exists(Path.Combine(Application.persistentDataPath, "animalinventory.json")))
     {
         Debug.Log("loading animalinventory.json");
         AnimalInventory.LoadFromJSON(Path.Combine(Application.persistentDataPath, "animalinventory.json "));
     }
     else
     {
         Debug.Log("couldn't find animalinventory, loading from template.");
         AnimalInventory.InitializeFromDefault();
     }
 }
Пример #4
0
 public static void LoadFromTemplate()
 {
     AnimalInventory.InitializeFromDefault();
 }