// Gather together all details needed to save the game and initiate the save.
    public void GatherSaveDetails()
    {
        if (SavingGameAllowed == false)
        {
            Debug.Log("Saving the game is disabled.");
            return;
        }

        Collectables.Clear();
        Interactables.Clear();

        // FindObjectsOfType<Collectable>().Where(a => a.CollectableCollected == true).ToList<Collectable>().ForEach(x => Collectables.Add(new CollectableSave(x.CollectableID, x.CollectableType, x.CollectableCollected)));

        FindObjectsOfType <Interactable>().ToList <Interactable>().ForEach(x => Interactables.Add(new InteractableSave(x.InteractableID, x.IsDisabled, x.IsLocked, x.IsActivated)));

        // Hardcoding for the time being...
        SaveDetails gatheredSaveDetails = new SaveDetails(
            LoadSaveController.SaveGameLocation,
            MainGameController.current.player.transform.position,
            TotalTimePlayed,
            DateTime.Now,
            LoadSaveController.LoadedCollectables,
            //Collectables,
            Interactables);

        LoadSaveController.SaveMainGame(gatheredSaveDetails);
    }
Exemple #2
0
    void Start()
    {
        // QualityPresets
        PopulateQualityPresetsDropdown();
        PopulateGameResolutionDropdown();

        OptionsMenuFullscreen.isOn = Screen.fullScreen;

        // Add listeners to all the allocated Buttons.
        AddListener(MainMenuContinue, delegate { LoadSaveController.LoadMainGame("saveGameTest.xml"); });
        AddListener(MainMenuNewGame, delegate { LoadSaveController.LoadMainGame(""); });
        AddListener(MainMenuOptions, delegate { ChangeMainMenuState(MainMenuState.OptionsMenu); });
        AddListener(MainMenuQuit, Application.Quit);

        AddListener(OptionsMenuSave, SaveButton_OnClick);
        AddListener(OptionsMenuRevert, null);
        AddListener(OptionsMenuClose, delegate { ChangeMainMenuState(MainMenuState.MainMenu); });
    }
 void Start()
 {
     GetComponent <Button>().onClick.AddListener(delegate { LoadSaveController.LoadMainGame(tempSaveGameLocation); });
 }