//THINGS TO SAVE
    //inventory
    //dialogue

    public static void SaveGlobalProgress(GlobalProgressChecker gpc)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Application.persistentDataPath + "/globalprog.bug";
        FileStream      stream    = new FileStream(path, FileMode.Create);

        GlobalProgData data = new GlobalProgData(gpc);

        formatter.Serialize(stream, data);
        stream.Close();
    }
    //1,0 silkworm
    //1,1 peanut clock 1
    //1,2 peanut clock 2
    //1,3 flower 1
    //1,4 flower 2

    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
            return;
        }

        DontDestroyOnLoad(gameObject);
    }
示例#3
0
    public GlobalProgData(GlobalProgressChecker gpc)
    {
        currentScene  = gpc.sceneName;
        bugsRemaining = gpc.bugsRemaining;

        garden1Progress = new bool[gpc.garden1ProgressCheck.Length];
        for (int i = 0; i < gpc.garden1ProgressCheck.Length; i++)
        {
            garden1Progress[i] = gpc.garden1ProgressCheck[i];
        }

        garden2Progress = new bool[gpc.garden2ProgressCheck.Length];
        for (int i = 0; i < gpc.garden2ProgressCheck.Length; i++)
        {
            garden2Progress[i] = gpc.garden2ProgressCheck[i];
        }
    }