Ejemplo n.º 1
0
    // Přesvědčí se, zda se už něco nenačítá a poté zavolá Coroutine, která načte scénu s postavou a druhou scénu s výběrem úrovní
    public void LoadGame(string path, SaveableSettings playerSettings)
    {
        if (_loading)
        {
            return;
        }

        _currentSavePath = path;
        StartCoroutine(LoadGameAsync(HUB_SCENE_NAME, PLAYER_SCENE_NAME, playerSettings));
    }
Ejemplo n.º 2
0
    // Inicializace, viditelná je úvodní obrazovka
    void Start()
    {
        _menuCanvas.enabled          = true;
        _saveSelectionCanvas.enabled = false;
        _settingsCanvas.enabled      = false;
        _controlsCanvas.enabled      = false;

        _errorTMPT.enabled = false;

        _savedGames = CheckForSavedGames();
        _settings   = GameManager.Instance.LoadSettings();
        _xSensitivitySlider.value = _settings.xSensitivity;
        _ySensitivitySlider.value = _settings.ySensitivity;
    }
Ejemplo n.º 3
0
    // Načte nastavení, případně vytvoří nové
    public SaveableSettings LoadSettings()
    {
        string fullPath = Path.Combine(Application.persistentDataPath, SETTINGS_FILE);

        if (LoadManager.FileExists(fullPath))
        {
            return(LoadManager.ReadFile <SaveableSettings>(fullPath));
        }
        else
        {
            SaveableSettings settings = new SaveableSettings();
            LoadManager.SaveFile <SaveableSettings>(fullPath, settings);
            return(settings);
        }
    }
Ejemplo n.º 4
0
    //  Načte scénu s postavou a výběrem levelů, poté předá portálům a prodavačovi odkaz na hráčovu pozici a také cestu, kam ukládat postup
    IEnumerator LoadGameAsync(string locationSceneName, string playerSceneName, SaveableSettings playerSettings)
    {
        _loading = true;
        _loadingScreen.ShowLoadingScreen();

        AsyncOperation locationSceneLoadingTask = SceneManager.LoadSceneAsync(locationSceneName, LoadSceneMode.Additive);

        locationSceneLoadingTask.allowSceneActivation = false;

        AsyncOperation playerSceneLoadingTask = SceneManager.LoadSceneAsync(playerSceneName, LoadSceneMode.Additive);

        playerSceneLoadingTask.allowSceneActivation = false;

        while (locationSceneLoadingTask.progress < 0.9f && playerSceneLoadingTask.progress < 0.9f)
        {
            yield return(null);
        }

        locationSceneLoadingTask.allowSceneActivation = true;
        while (!locationSceneLoadingTask.isDone)
        {
            yield return(null);
        }

        playerSceneLoadingTask.allowSceneActivation = true;
        while (!playerSceneLoadingTask.isDone)
        {
            yield return(null);
        }

        SceneManager.SetActiveScene(SceneManager.GetSceneByName(locationSceneName));

        while (Player == null || CurrentHubManager == null || InputManager == null)
        {
            yield return(null);
        }

        Player.GetComponent <PlayerController>().GetPlayerInventory().Load(Path.Combine(Application.persistentDataPath, SAVES_FOLDER, _currentSavePath, PLAYER_INVENTORY));
        InputManager.GetCameraTransform().GetComponent <CameraController>().SetSensitivity(playerSettings.xSensitivity, playerSettings.ySensitivity);

        CurrentHubManager.LoadState(Path.Combine(Application.persistentDataPath, SAVES_FOLDER, _currentSavePath, GAME_FILE));
        CurrentHubManager.EnablePlayerDependantObjects(Player.transform, InputManager.GetCameraTransform(), Path.Combine(Application.persistentDataPath, SAVES_FOLDER, _currentSavePath, "shop.inv"));

        UnloadScene(MENU_SCENE_NAME);
        _loading = false;
        _loadingScreen.HideLoadingScreen();
    }
Ejemplo n.º 5
0
 // Uloží nastavení
 public void SaveSettings(SaveableSettings settings)
 {
     LoadManager.SaveFile <SaveableSettings>(Path.Combine(Application.persistentDataPath, SETTINGS_FILE), settings);
 }