Esempio n. 1
0
    protected IEnumerator LoadCoroutine(string sceneName, LoadSceneMode mode)
    {
        _isChangingScene = true;
        AsyncOperation loadingScene = SceneManager.LoadSceneAsync(sceneName, mode);

        while (!loadingScene.isDone)
        {
            yield return(null);
        }
        _loadedScene = (SceneString)Enum.Parse(typeof(SceneString), sceneName);

        if (PARTY_TYPE == EPartyType.NEW)
        {
            FtueManager.instance.Launch();
        }

        if (EarthManager.Instance.playingPlanetName == EarthManager.Instance.planetName && !TimeManager.Instance.active)
        {
            WorldManager.Instance.InitPolution();
            if (PARTY_TYPE == EPartyType.SAVE)
            {
                TimeManager.Instance.LoadSave();
            }
            TimeManager.Instance.Active();
            PlanetSave.SaveParty();
        }

        _isChangingScene = false;
        Events.Instance.Raise(new SharePlayerPosition(EarthManager.Instance.playerPositions));
        Events.Instance.Raise(new OnSceneLoaded(_loadedScene));
        UIManager.instance.ActivePanelTransition(false);
        if (!_gameStarted)
        {
            _gameStarted = true;
            Events.Instance.Raise(new OnSwitchScene(ECameraTargetType.MAP));
        }
    }
Esempio n. 2
0
    public void GoToMenu()
    {
        if (!FtueManager.instance.active)
        {
            PlanetSave.SaveParty();
        }

        _gameStarted = false;
        UIManager.instance.Clear();
        TimeManager.Instance.Stop();
        LinkDatabase.Instance.Clear();
        WorldManager.Instance.Clear();
        ControllerInput.instance.ResetDatasTouch();
        InteractablePNJ.PNJs.Clear();
        ResourcesManager.Instance.Clear();
        CameraManager.Instance.Reset();
        InventoryPlayer.Instance.Clear();
        PlayerManager.Instance.Clear();
        EarthManager.Instance.DestroyPlanet();

        Events.Instance.Raise(new OnGoToMenu());

        StartCoroutine(LoadMainMenu());
    }