Exemple #1
0
    public static bool Save(int savenum, ref FieldScript field)
    {
        lengthx = field.GetSizeForSave().first;
        lengthz = field.GetSizeForSave().second;
        if (field == null)
        {
            Debug.Log("Save fail");
            return(false);
        }
        else
        {
            bool[] CellStatsRS;
            CellStatsRS = new bool[lengthx * lengthz];

            for (int i = 0; i < lengthx; i++)
            {
                for (int z = 0; z < lengthz; z++)
                {
                    CellStatsRS[i * lengthz + z] = field.CellStatsR[i, z];
                }
            }
            PlayerPrefsX.SetBoolArray(savenum + ".cstatsr", CellStatsRS);
            PlayerPrefs.Save();
            PlayerPrefs.SetInt(savenum + ".x", lengthx);
            PlayerPrefs.SetInt(savenum + ".z", lengthz);
            Debug.Log("saved on " + savenum + " with: " + lengthx + ", " + lengthz);
            return(true);
        }
    }