Example #1
0
    public void Save()
    {
        if (!canSave)
        {
            BM.Broadcast("You can not save at this time!");
            return;
        }
        if (!player.isHome)
        {
            BM.Broadcast("You can not save outside of your home!");
            return;
        }
        PlayerPrefs.SetInt("GameSaved", 1);
        player.Save(); // must be before levelTree
        levelTree.Save();
        questSystem.Save();
        shopManager.Save();
        planetGenerator.Save();
        money.Save();
        shopManager.GetComponent <ResourceInventory>().Save();
        alminac.Save();
        inventory.Save();
        if (popupsOn)
        {
            PlayerPrefs.SetInt("popupsOn", 1);
        }
        else
        {
            PlayerPrefs.SetInt("popupsOn", 0);
        }

        if (lightsOn)
        {
            PlayerPrefs.SetInt("lightsOn", 1);
        }
        else
        {
            PlayerPrefs.SetInt("lightsOn", 0);
        }

        map.Save();
        home.Save();
        BM.Broadcast("Saved");
        player.Save();
        FindObjectOfType <EnemyInvasionManager>().Save();
        MaxItemsManager.Save();
        player.gameObject.GetComponent <PlayerController>().Save();
    }