Beispiel #1
0
    /// <summary>
    /// Loads the level.
    /// </summary>
    /// <param name="levelData">The level data.</param>
    public void LoadLevel(LevelLoadData levelData)
    {
        if (this.IsLoading)
        {
            return;
        }

        if (this.WaitingForTransition && this._transitionLoadData != levelData)
        {
            return;
        }

        if (!this.WaitingForTransition && levelData.Transitions.DisplayTransition)
        {
            this._transitionLoadData = levelData;
            this.beginTransitionEvent?.Call(levelData.Transitions.TransitionName);
            return;
        }

        if (levelData.ShowLoadingSceen)
        {
            SceneManager.LoadScene("LoadingScreen");
            this.switchLevelEvent?.Call();
            GenerateLoadingScene(levelData.RandomLoadTime, levelData);
            return;
        }

        GenerateLoadingScene(0f, levelData);
    }
Beispiel #2
0
 public LoadingScene(string sceneToLoad, StringEvent beginEvent, LevelLoadData data, float maxLoadTime)
 {
     this._transitionData = data.Transitions;
     this._sceneToLoad    = sceneToLoad;
     this._maxLoadTime    = maxLoadTime;
     this._beginEvent     = beginEvent;
     this._displayLoading = data.ShowLoadingSceen;
 }
Beispiel #3
0
    private void OnMidTransition()
    {
        if (this.IsLoading)
        {
            this._currentLoadingScene.OnMidTransition();
            return;
        }

        if (this._transitionLoadData != null)
        {
            this.LoadLevel(this._transitionLoadData);
            this._transitionLoadData = null;
        }
    }
 /// <summary>
 /// Called when the credits button was pressed.
 /// </summary>
 /// <param name="levelLoadData">The level load data.</param>
 public void OnCreditsButtonPressed(LevelLoadData levelLoadData)
 {
     this.levelLoaderReference.Loader?.LoadLevel(levelLoadData);
 }
Beispiel #5
0
 private void GenerateLoadingScene(float loadingTime, LevelLoadData levelData)
 {
     this._currentLoadingScene = new LoadingScene(levelData.LevelToLoad, this.beginTransitionEvent, levelData, loadingTime);
     this._currentLoadingScene.SceneLoadedEvent += OnCompleted;
 }
 public void ExitCredits(LevelLoadData loadData)
 {
     this.levelLoaderReference.Loader?.LoadLevel(loadData);
 }