public SaveFileObject Load() { string content = File.ReadAllText(fileName); SaveFileObject temp = new SaveFileObject(); temp = JsonUtility.FromJson <SaveFileObject>(content); return(temp); }
public void LoadSaveFileObject() { SaveFileObject saveFileObject = fileManager.Load(); lifesCount = saveFileObject.gameController_LifeCounts; currentScore = saveFileObject.gameController_Score; ball.SetCurrentPosition(saveFileObject.ball_Position); ball.SetCurrentForce(saveFileObject.ball_Velocity); playerPlatform.SetCurrentPosition(saveFileObject.platform_Position); PointsController.LoadPointsInstancesList(saveFileObject.pointsIdsInstance); uIController.UpdateLifeImageList(lifesCount); uIController.UpdateScoreText(currentScore); }
public void SaveFileObject() { SaveFileObject saveFileObject = new SaveFileObject(); saveFileObject.gameController_LifeCounts = lifesCount; saveFileObject.gameController_Score = currentScore; saveFileObject.ball_Position = ball.GetCurrentPosition(); saveFileObject.ball_Velocity = ball.GetCurrentForce(); saveFileObject.platform_Position = playerPlatform.GetCurrentPosition(); saveFileObject.pointsIdsInstance = PointsController.GetPointsInstancesList(); fileManager.Save(saveFileObject); Debug.Log("File save"); }
public void Save(SaveFileObject temp) { string content = JsonUtility.ToJson(temp); File.WriteAllText(fileName, content); }