Пример #1
0
    public SaveFileObject Load()
    {
        string         content = File.ReadAllText(fileName);
        SaveFileObject temp    = new SaveFileObject();

        temp = JsonUtility.FromJson <SaveFileObject>(content);
        return(temp);
    }
Пример #2
0
    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);
    }
Пример #3
0
    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");
    }
Пример #4
0
    public void Save(SaveFileObject temp)
    {
        string content = JsonUtility.ToJson(temp);

        File.WriteAllText(fileName, content);
    }