void SaveGame()
    {
        SavePosition s = new SavePosition();

        s.x                      = player1.transform.position.x;
        s.y                      = player1.transform.position.y;
        s.z                      = player1.transform.position.z;
        s.yRotation              = player1.transform.eulerAngles.y;
        s.kick                   = PersistentData.singleton.kick;
        s.punch                  = PersistentData.singleton.punch;
        s.lifePoints             = PersistentData.singleton.lifePoints;
        s.lifePointsDarkDragon1  = PersistentData.singleton.lifePointsDarkDragon1;
        s.lifePointsDarkDragon2  = PersistentData.singleton.lifePointsDarkDragon2;
        s.lifePointsDarkDragon3  = PersistentData.singleton.lifePointsDarkDragon3;
        s.lifePointsDarkDragon4  = PersistentData.singleton.lifePointsDarkDragon4;
        s.lifePointsDarkDragon5  = PersistentData.singleton.lifePointsDarkDragon5;
        s.lifePointsDarkDragon6  = PersistentData.singleton.lifePointsDarkDragon6;
        s.lifePointsDarkDragon7  = PersistentData.singleton.lifePointsDarkDragon7;
        s.lifePointsDarkDragon8  = PersistentData.singleton.lifePointsDarkDragon8;
        s.lifePointsDarkDragon9  = PersistentData.singleton.lifePointsDarkDragon9;
        s.lifePointsDarkDragon10 = PersistentData.singleton.lifePointsDarkDragon10;
        s.lifePointsBlueDragon   = PersistentData.singleton.lifePointsBlueDragon;
        s.lifePointsRedDragon    = PersistentData.singleton.lifePointsRedDragon;
        s.lifePointsGreenDragon  = PersistentData.singleton.lifePointsGreenDragon;
        s.lifePointsPurpleDragon = PersistentData.singleton.lifePointsPurpleDragon;
        string json = JsonUtility.ToJson(s);

        Debug.Log(json);
        PlayerPrefs.SetString("PlayerLocation", json);
    }
Beispiel #2
0
    void Start()
    {
        Time.timeScale = 1;

        //attach components
        _char = GetComponent <CharacterController>();
        _absoluteTransform = Camera.main.transform;
        _sprite            = transform.Find("Sprite");
        _legs         = _sprite.Find("Legs").GetComponent <LegsScript>();
        _face         = _sprite.Find("Face").GetComponent <FaceScript>();
        _dialogue     = GameObject.FindGameObjectWithTag("Dialogue").GetComponent <DialogueScript>();
        _faceStartPos = _face.transform.localPosition;
        _save         = GetComponent <SavePosition>();

        //set init vars
        _startPosSprite = _sprite.localPosition;

        float savedPos = _save.Load();

        if (savedPos != 0)
        {
            Vector3 newPos = transform.position;
            newPos.x           = savedPos;
            transform.position = newPos;
        }
    }
    public void LoadCell()
    {
        Destory();

        for (int i = 0; i < GlobalGeneration.TotalCells; i++)
        {
            Vector3      position   = new Vector3();
            string       CellLocale = PlayerPrefs.GetString("CellLocation " + i);
            SavePosition cellSave   = JsonUtility.FromJson <SavePosition>(CellLocale);


            if (cellSave != null && CellLocale.Length > 0)
            {
                cellSave = JsonUtility.FromJson <SavePosition>(CellLocale);
                if (cellSave != null)
                {
                    GameObject cellToLoad = (GameObject)Instantiate(cellSave.currentGameObject);
                    cellToLoad.name = cellSave.currentGameObject.name;

                    position.x = cellSave.x;
                    position.y = cellSave.y;
                    position.z = cellSave.z;
                    cellToLoad.transform.position = position;
                }
                //GameObject test = Instantiate(cellToSave[i].gameObject, new Vector3(position.x + position.y, position.z), Quaternion.identity);
            }
        }
    }
Beispiel #4
0
 // Use this for initialization
 void Start()
 {
     _rotationSpeed = _speed;
     _sprite        = transform.Find("Sprite");
     _squish        = _sprite.GetComponent <Squishy>();
     _save          = GameObject.FindGameObjectWithTag("Player").GetComponent <SavePosition>();
 }
    public void LoadCell()
    {
        for (int i = 0; i < 2; i++)
        {
            Vector3      position   = new Vector3();
            string       CellLocale = PlayerPrefs.GetString("CellLocation " + i);
            SavePosition cellSave   = JsonUtility.FromJson <SavePosition>(CellLocale);


            if (cellSave != null && CellLocale.Length > 0)
            {
                cellSave = JsonUtility.FromJson <SavePosition>(CellLocale);
                Instantiate(cellSave.currentGameObject);
                cellSave.currentGameObject.name = i.ToString();
                position = new Vector3();

                position.x = cellSave.x;
                position.y = cellSave.y;
                position.z = cellSave.z;
                cellSave.currentGameObject.transform.position = position;


                Instantiate(cellToSave[i], new Vector3(position.x + position.y, position.z), Quaternion.identity);
            }
        }
    }
    void UnsaveGame()
    {
        SavePosition s = new SavePosition();

        s.x                      = 10.24219f;
        s.y                      = 0f;
        s.yRotation              = -1.927f;
        s.z                      = -6.04727f;
        s.kick                   = 0;
        s.punch                  = 0;
        s.lifePoints             = 100;
        s.lifePointsDarkDragon1  = 10;
        s.lifePointsDarkDragon2  = 10;
        s.lifePointsDarkDragon3  = 10;
        s.lifePointsDarkDragon4  = 10;
        s.lifePointsDarkDragon5  = 10;
        s.lifePointsDarkDragon6  = 10;
        s.lifePointsDarkDragon7  = 10;
        s.lifePointsDarkDragon8  = 10;
        s.lifePointsDarkDragon9  = 10;
        s.lifePointsDarkDragon10 = 10;
        s.lifePointsBlueDragon   = 10;
        s.lifePointsRedDragon    = 10;
        s.lifePointsGreenDragon  = 10;
        s.lifePointsPurpleDragon = 10;
        for (int i = 0; i < player1.gameObject.GetComponent <Player>().dragons.Length; i++)
        {
            player1.gameObject.GetComponent <Player>().dragons[i].SetActive(true);
        }
        string json = JsonUtility.ToJson(s);

        Debug.Log(json);
        PlayerPrefs.SetString("PlayerLocation", json);
    }
 void Awake()
 {
     if (Instance == null)
     {
         DontDestroyOnLoad(gameObject);
         Instance = this;
     }
     else if (Instance != this)
     {
         Destroy(gameObject);
     }
 }
Beispiel #8
0
    void SaveGame()
    {
        SavePosition s = new SavePosition();

        s.x = player.transform.position.x;
        s.y = player.transform.position.y;
        s.z = player.transform.position.z;

        string json = JsonUtility.ToJson(s);

        Debug.Log(json);
        PlayerPrefs.SetString("PlayerLocation", json);
    }
Beispiel #9
0
    // Use this for initialization
    void Start()
    {
        Posicion = transform;
        //current pos = new position
        transform.position = new Vector3(12f, -5.6f, 0);


        _savePosition     = GameObject.Find("savePosition").GetComponent <SavePosition>();
        _scrollBackground = GameObject.Find("Background").GetComponent <ScrollBackground>();
        _uiManager        = GameObject.Find("Canvas").GetComponent <UIManager>();

        if (_uiManager != null)
        {
            _uiManager.UpdateLives(_lives);
        }
    }
    public void RestoreGame()
    {
        string p = PlayerPrefs.GetString("PlayerLocation");

        if (p != null && p.Length > 0)
        {
            SavePosition s = JsonUtility.FromJson <SavePosition>(p);


            if (s != null)
            {
                Vector3 position = new Vector3();
                position.x = s.x;
                position.y = s.y;
                position.z = s.z;
                block.transform.position = position;
            }
        }

        DeleteAll();

        //SavePosition[] blocksPostions = JsonUtility.FromJson<SavePosition>(BlocksLocale);

        for (int i = 0; i < 401; i++)
        {
            Vector3 position     = new Vector3();
            string  BlocksLocale = PlayerPrefs.GetString("BlocksLocation " + i);
            //SavePosition d = JsonUtility.FromJson<SavePosition>(BlocksLocale);
            SavePosition blocksPostions = JsonUtility.FromJson <SavePosition>(BlocksLocale);

            if (blocksPostions != null && BlocksLocale.Length > 0)
            {
                blocksPostions = JsonUtility.FromJson <SavePosition>(BlocksLocale);
                Instantiate(blocksPostions.currentGameObject);
                blocksPostions.currentGameObject.name = i.ToString();
                position = new Vector3();

                position.x = blocksPostions.x;
                position.y = blocksPostions.y;
                position.z = blocksPostions.z;
                blocksPostions.currentGameObject.transform.position = position;


                //Instantiate(blocksToSave[i], new Vector3(positions[i].x + blocksPostions[i].y, blocksPostions[i].z), Quaternion.identity);
            }
        }
    }
Beispiel #11
0
    void RestoreGame()
    {
        string p = PlayerPrefs.GetString("PlayerLcoation");

        if (p != null && p.Length > 0)
        {
            SavePosition s = JsonUtility.FromJson <SavePosition>(p);
            if (s != null)
            {
                Vector3 position = new Vector3();
                position.x = s.x;
                position.y = s.y;
                position.z = s.z;
                player.transform.position = position;
            }
        }
    }
Beispiel #12
0
    public static void SaveInfo(
        SaveCamera saveCameraManager,
        SavePosition savePositionManager,
        SaveItem.Items saveItemManager,
        SaveInventory.Counts saveInventoryManager,
        SavePuzzle.Puzzles savePuzzleManager
        )
    {
        BinaryFormatter binary     = new BinaryFormatter();
        string          path       = Application.persistentDataPath + "/savedGame.mzcd";
        FileStream      fileStream = new FileStream(path, FileMode.Create);
        SaveManager     saveInfo   = new SaveManager(savePositionManager.position.defaultValue, saveCameraManager.maxPositionMap, saveCameraManager.minPositionMap,
                                                     saveCameraManager.resetMaxPosition, saveCameraManager.resetMinPosition, saveItemManager, saveInventoryManager, savePuzzleManager);
        var json = JsonUtility.ToJson(saveInfo);

        Debug.Log("SALVANDO ---" + json);
        binary.Serialize(fileStream, json);
        fileStream.Close();
    }
 public void _saving()
 {
     try
     {
         SavePosition saveData = new SavePosition();
         // do something
         saveData.getPos().Clear();
         saveData.setPos(posCopy);
         BinaryFormatter bf = new BinaryFormatter();
         FileStream      fs = new FileStream(Application.persistentDataPath + "/Position.txt", FileMode.OpenOrCreate);
         bf.Serialize(fs, saveData);
         fs.Close();
     }
     catch (Exception e)
     {
         print(e);
     }
     print("saved data to " + Application.persistentDataPath + "/Position.txt");
 }
Beispiel #14
0
    void SaveGame() //debugged
    {
        Color gameobj = player.GetComponent <MeshRenderer>().material.color;

        Debug.Log("This is gameobj before string: " + gameobj);                       //kosher
        PlayerPrefs.SetString("StoredColor", ColorUtility.ToHtmlStringRGBA(gameobj)); // kosher
        Debug.Log("This is gameobj: " + gameobj);                                     //kosher
        Debug.Log("This is storedColor: " + ColorUtility.ToHtmlStringRGBA(gameobj));  //kosher

        SavePosition s = new SavePosition();

        s.x = player.transform.position.x;
        s.y = player.transform.position.y;

        string json = JsonUtility.ToJson(s);

        Debug.Log(json);
        PlayerPrefs.SetString("PlayerLocation", json);
    }
 public void _Loading()
 {
     if (File.Exists(Application.persistentDataPath + "/Position.txt"))
     {
         try
         {
             SavePosition    saveData = new SavePosition();
             BinaryFormatter bf       = new BinaryFormatter();
             FileStream      fs       = new FileStream(Application.persistentDataPath + "/Position.txt", FileMode.Open);
             saveData = (SavePosition)bf.Deserialize(fs);
             fs.Close();
             posCopy = saveData.getPos();
             // do somthing
         }
         catch (Exception e)
         {
             print(e);
         }
     }
 }
Beispiel #16
0
    void RestoreGame()
    {
        Debug.Log(PlayerPrefs.GetString("StoredColor"));
        string storedColorAsString = "#" + PlayerPrefs.GetString("StoredColor");

        Debug.Log("This is storedColorAsString: " + storedColorAsString);
        ColorUtility.TryParseHtmlString(storedColorAsString, out result);
        Debug.Log("This is result: " + result);
        player.GetComponent <MeshRenderer>().material.color = result;

        // Debug.Log(PlayerPrefs.GetString("StoredColor")); //kosher
        // string storedColorAsString = "#" + PlayerPrefs.GetString("StoredColor");
        // if (storedColorAsString != null && storedColorAsString.Length > 0)
        // {
        // // Debug.Log("This is storedColorAsString: " + storedColorAsString); //kosher
        // ColorUtility.TryParseHtmlString(storedColorAsString, out result); //kosher
        //     if (result != null){
        //           player.GetComponent<MeshRenderer>().material.color = result;
        //         //       Debug.Log("This is result: " + result); //kosher
        //           // player.GetComponent<MeshRenderer>().material.color = Color.blue;
        //     }
        // }


        string p = PlayerPrefs.GetString("PlayerLocation");

        if (p != null && p.Length > 0)
        {
            SavePosition s = JsonUtility.FromJson <SavePosition>(p);
            if (s != null)
            {
                Vector2 position = new Vector2();
                position.x = s.x;
                position.y = s.y;
                player.transform.position = position;
            }
        }
        // player.GetComponent<MeshRenderer>().material.SetColor("_Color", result);
    }
    public void SaveCell()
    {
        for (int i = 0; i < GlobalGeneration.TotalCells; i++)
        {
            string        dataToSave    = "";
            List <string> blockDataList = new List <string>();

            cellToSave[i] = GameObject.Find("Cell Number: " + i);


            foreach (Transform child in cellToSave[i].transform)
            {
                Transform    CurrentChildFound = child;
                SavePosition blockData         = new SavePosition();
                blockData.name = CurrentChildFound.name;
                blockData.currentGameObject = CurrentChildFound.gameObject;
                blockData.x = CurrentChildFound.transform.position.x;
                blockData.y = CurrentChildFound.transform.position.y;
                blockData.z = CurrentChildFound.transform.position.z;


                dataToSave += JsonUtility.ToJson(blockData);

                System.IO.File.WriteAllText(path, dataToSave);
                Debug.Log(dataToSave);

                PlayerPrefs.SetString("CellLocation " + i, dataToSave);
            }

            //SavePosition cellSave = new SavePosition();
            //cellSave.name = cellToSave[i].name;
            //cellSave.currentGameObject = cellToSave[i];
            //CellToLoad = cellSave.currentGameObject;
            //cellSave.x = cellToSave[i].transform.position.x;
            //cellSave.y = cellToSave[i].transform.position.y;
            //cellSave.z = cellToSave[i].transform.position.z;
        }
    }
    public void SaveCell()
    {
        for (int i = 0; i < MaxBlocks; i++)
        {
            cellToSave[i] = GameObject.Find("Cell Number: " + i);

            if (cellToSave[i] == null)
            {
                cellToSave[i] = empty;
            }

            SavePosition cellSave = new SavePosition();
            cellSave.currentGameObject = cellToSave[i];
            cellSave.x = cellToSave[i].transform.position.x;
            cellSave.y = cellToSave[i].transform.position.y;
            cellSave.z = cellToSave[i].transform.position.z;


            string CellsToJson = JsonUtility.ToJson(cellSave);
            Debug.Log(CellsToJson);
            PlayerPrefs.SetString("CellLocation " + i, CellsToJson);
        }
    }
Beispiel #19
0
 private void Awake()
 {
     l_j = MGR.Get_instance().transform.GetChild((int)Enum.Managerlist.Player).GetComponent <PlayerManagerScripts>().Load_Job;
     s_u = MGR.Get_instance().transform.GetChild((int)Enum.Managerlist.Skill).GetComponent <SkillManagerScript>().Set_Player;
     s_p = MGR.Get_instance().transform.GetChild((int)Enum.Managerlist.Player).GetComponent <PlayerManagerScripts>().Set_OldPosition;
 }
    void RestoreGame()
    {
        string p = PlayerPrefs.GetString("PlayerLocation");

        if (p != null && p.Length > 0)
        {
            SavePosition s = JsonUtility.FromJson <SavePosition>(p);
            if (s != null)
            {
                Vector3 position = new Vector3();
                position.x = s.x;
                position.y = s.y;
                position.z = s.z;
                player1.transform.position = position;
                SavePosition playerPoints = new SavePosition();
                playerPoints.kick                               = s.kick;
                playerPoints.punch                              = s.punch;
                playerPoints.lifePoints                         = s.lifePoints;
                playerPoints.yRotation                          = s.yRotation;
                playerPoints.lifePointsDarkDragon1              = s.lifePointsDarkDragon1;
                playerPoints.lifePointsDarkDragon2              = s.lifePointsDarkDragon2;
                playerPoints.lifePointsDarkDragon3              = s.lifePointsDarkDragon3;
                playerPoints.lifePointsDarkDragon4              = s.lifePointsDarkDragon4;
                playerPoints.lifePointsDarkDragon5              = s.lifePointsDarkDragon5;
                playerPoints.lifePointsDarkDragon6              = s.lifePointsDarkDragon6;
                playerPoints.lifePointsDarkDragon7              = s.lifePointsDarkDragon7;
                playerPoints.lifePointsDarkDragon8              = s.lifePointsDarkDragon8;
                playerPoints.lifePointsDarkDragon9              = s.lifePointsDarkDragon9;
                playerPoints.lifePointsDarkDragon10             = s.lifePointsDarkDragon10;
                playerPoints.lifePointsBlueDragon               = s.lifePointsBlueDragon;
                playerPoints.lifePointsRedDragon                = s.lifePointsRedDragon;
                playerPoints.lifePointsGreenDragon              = s.lifePointsGreenDragon;
                playerPoints.lifePointsPurpleDragon             = s.lifePointsPurpleDragon;
                player1.transform.eulerAngles                   = new Vector3(0f, playerPoints.yRotation, 0f);
                PersistentData.singleton.kick                   = playerPoints.kick;
                PersistentData.singleton.punch                  = playerPoints.punch;
                PersistentData.singleton.lifePoints             = playerPoints.lifePoints;
                PersistentData.singleton.lifePointsDarkDragon1  = playerPoints.lifePointsDarkDragon1;
                PersistentData.singleton.lifePointsDarkDragon2  = playerPoints.lifePointsDarkDragon2;
                PersistentData.singleton.lifePointsDarkDragon3  = playerPoints.lifePointsDarkDragon3;
                PersistentData.singleton.lifePointsDarkDragon4  = playerPoints.lifePointsDarkDragon4;
                PersistentData.singleton.lifePointsDarkDragon5  = playerPoints.lifePointsDarkDragon5;
                PersistentData.singleton.lifePointsDarkDragon6  = playerPoints.lifePointsDarkDragon6;
                PersistentData.singleton.lifePointsDarkDragon7  = playerPoints.lifePointsDarkDragon7;
                PersistentData.singleton.lifePointsDarkDragon8  = playerPoints.lifePointsDarkDragon8;
                PersistentData.singleton.lifePointsDarkDragon9  = playerPoints.lifePointsDarkDragon9;
                PersistentData.singleton.lifePointsDarkDragon10 = playerPoints.lifePointsDarkDragon10;
                PersistentData.singleton.lifePointsBlueDragon   = playerPoints.lifePointsBlueDragon;
                PersistentData.singleton.lifePointsRedDragon    = playerPoints.lifePointsRedDragon;
                PersistentData.singleton.lifePointsGreenDragon  = playerPoints.lifePointsGreenDragon;
                PersistentData.singleton.lifePointsPurpleDragon = playerPoints.lifePointsPurpleDragon;
                if (player1.gameObject.GetComponent <Player>().dragons.Length == 10)
                {
                    if (PersistentData.singleton.lifePointsDarkDragon1 != 0)
                    {
                        player1.gameObject.GetComponent <Player>().dragons[0].SetActive(true);
                    }
                    if (PersistentData.singleton.lifePointsDarkDragon2 != 0)
                    {
                        player1.gameObject.GetComponent <Player>().dragons[1].SetActive(true);
                    }
                    if (PersistentData.singleton.lifePointsDarkDragon3 != 0)
                    {
                        player1.gameObject.GetComponent <Player>().dragons[2].SetActive(true);
                    }
                    if (PersistentData.singleton.lifePointsDarkDragon4 != 0)
                    {
                        player1.gameObject.GetComponent <Player>().dragons[3].SetActive(true);
                    }
                    if (PersistentData.singleton.lifePointsDarkDragon5 != 0)
                    {
                        player1.gameObject.GetComponent <Player>().dragons[4].SetActive(true);
                    }
                    if (PersistentData.singleton.lifePointsDarkDragon6 != 0)
                    {
                        player1.gameObject.GetComponent <Player>().dragons[5].SetActive(true);
                    }
                    if (PersistentData.singleton.lifePointsDarkDragon7 != 0)
                    {
                        player1.gameObject.GetComponent <Player>().dragons[6].SetActive(true);
                    }
                    if (PersistentData.singleton.lifePointsDarkDragon8 != 0)
                    {
                        player1.gameObject.GetComponent <Player>().dragons[7].SetActive(true);
                    }
                    if (PersistentData.singleton.lifePointsDarkDragon9 != 0)
                    {
                        player1.gameObject.GetComponent <Player>().dragons[8].SetActive(true);
                    }
                    if (PersistentData.singleton.lifePointsDarkDragon10 != 0)
                    {
                        player1.gameObject.GetComponent <Player>().dragons[9].SetActive(true);
                    }
                }
                else if (player1.gameObject.GetComponent <Player>().dragons.Length == 4)
                {
                    if (PersistentData.singleton.lifePointsBlueDragon != 0)
                    {
                        player1.gameObject.GetComponent <Player>().dragons[0].SetActive(true);
                    }
                    if (PersistentData.singleton.lifePointsRedDragon != 0)
                    {
                        player1.gameObject.GetComponent <Player>().dragons[1].SetActive(true);
                    }
                    if (PersistentData.singleton.lifePointsGreenDragon != 0)
                    {
                        player1.gameObject.GetComponent <Player>().dragons[2].SetActive(true);
                    }
                    if (PersistentData.singleton.lifePointsPurpleDragon != 0)
                    {
                        player1.gameObject.GetComponent <Player>().dragons[3].SetActive(true);
                    }
                }
            }
        }
    }
    public void SaveGame()
    {
        SavePosition s = new SavePosition();

        s.name = "hi";
        s.x    = block.transform.position.x;
        s.y    = block.transform.position.y;
        s.z    = block.transform.position.z;

        string json = JsonUtility.ToJson(s);

        Debug.Log(json);
        PlayerPrefs.SetString("PlayerLocation", json);

        //string test = JsonUtility.ToJson(s);

        MaxBlocks = GlobalGeneration.total - 1;
        for (int i = 0; i < MaxBlocks; i++)
        {
            blocksToSave[i] = GameObject.Find("" + i);

            if (blocksToSave[i] == null)
            {
                blocksToSave[i] = empty;
            }
        }

        MaxBlocks = GlobalGeneration.total - 1;
        //SavePosition[] blocksPostions = new SavePosition[MaxBlocks];

        for (int i = 1; i < MaxBlocks; i++)
        {
            SavePosition blocksPostions = new SavePosition();
            blocksPostions.name = "Block Number " + i;
            blocksPostions.currentGameObject = blocksToSave[i];

            if (blocksToSave[i].tag == "GrassPlain")
            {
                blocksPostions.currentGameObject = GrassBlock;
            }

            else if (blocksToSave[i].tag == "GrassTall")
            {
                blocksPostions.currentGameObject = GrassTall;
            }

            else if (blocksToSave[i].tag == "Tree")
            {
                blocksPostions.currentGameObject = Tree;
            }

            else if (blocksToSave[i].tag == "Rock")
            {
                blocksPostions.currentGameObject = Rock;
            }

            else if (blocksToSave[i].tag == "Dirt")
            {
                blocksPostions.currentGameObject = Dirt;
            }

            else
            {
                blocksToSave[i] = empty;
            }

            blocksPostions.x = blocksToSave[i].transform.position.x;
            blocksPostions.y = blocksToSave[i].transform.position.y;
            blocksPostions.z = blocksToSave[i].transform.position.z;

            string BlocksToJson = JsonUtility.ToJson(blocksPostions);
            Debug.Log(BlocksToJson);
            PlayerPrefs.SetString("BlocksLocation " + i, BlocksToJson);

            string ToJsonBlocks = JsonUtility.ToJson(s);
        }

        //for (int i = 0; i < GlobalGeneration.CurrentBlock.Length; i++)
        //{
        //    blocksToSave[i] = GlobalGeneration.CurrentBlock[i].gameObject;
        //    blocksToSave[i] = GameObject.Find("" + i);
        //    blocksPostions[i] = new SavePosition();
        //    blocksPostions[i].name = "Block Number " + i;
        //    blocksPostions[i].currentGameObject = GlobalGeneration.CurrentBlock[i].gameObject;
        //    blocksPostions[i].x = GlobalGeneration.CurrentBlock[i].gameObject.transform.position.x;
        //    blocksPostions[i].y = GlobalGeneration.CurrentBlock[i].gameObject.transform.position.y;
        //    blocksPostions[i].z = GlobalGeneration.CurrentBlock[i].gameObject.transform.position.z;

        //    string BlocksToJson = JsonUtility.ToJson(blocksPostions[i]);
        //    Debug.Log(BlocksToJson);
        //    PlayerPrefs.SetString("BlocksLocation " + i, BlocksToJson);
        //}
    }