/// <summary> /// Saves the current Game Data /// </summary> /// <param name="tankStats"></param> public static void SaveGameData(TankActor.TankStats tankStats) { GameData gmData = new GameData(tankStats); var json = JsonUtility.ToJson(gmData); if (_gameDataList.Count > 0) { var end = _gameDataList.Count - 1; // This is just to make sure that there is always only one copy of GameData _gameDataList[end] = gmData; } else { _gameDataList.Add(gmData); } }
/// <summary> /// This is meant to only be called once when the game begins /// </summary> public static void InitGameData() { if (_gameDataList.Count > 0) { Debug.LogError("InitGameData failed due to pre-existing initialized data..."); return; } else { TankActor.TankStats tankStats; tankStats = new TankActor.TankStats(); GameData gmData = new GameData(tankStats); _gameDataList.Add(gmData); Debug.Log("InitGameData called"); } }