Exemple #1
0
    public void ChangeState(State newState, System.Action OnStateChangedCallback = null)
    {
        SceneLoader.Scene newLevelToLoad = SceneLoader.Scene.MainMenu;

        System.Action callbacks = OnSceneLoaded;
        if (OnStateChangedCallback != null)
        {
            callbacks += OnStateChangedCallback;
        }

        switch (newState)
        {
        case State.Town:
            newLevelToLoad = SceneLoader.Scene.Town;
            sceneLoader.LoadScene(newLevelToLoad, callbacks);
            break;

        case State.Dungeon:
            newLevelToLoad = SceneLoader.Scene.Dungeon;
            sceneLoader.LoadScene(newLevelToLoad, callbacks);
            break;

        case State.Combat:
            newLevelToLoad = SceneLoader.Scene.Combat;
            sceneLoader.LoadScene(newLevelToLoad, callbacks);
            break;

        default:
            sceneLoader.LoadScene(newLevelToLoad, callbacks);
            break;
        }
        GameState = newState;
    }
Exemple #2
0
    /// <summary>
    /// setups everything there is to switch scene.
    /// </summary>
    void ChangeToGameScene(SceneLoader.Scene sceneToGoTo)
    {
        _transitionPanel.FadeIn();
        SceneLoader.targetScene = sceneToGoTo;
        _checkForTransition     = true;

        PlaySoundEffect();
    }
    public void LoadLevel(SceneLoader.Scene level)
    {
        SceneLoader.LoadAdditive(level);

        currentLevel = level;

        Invoke(nameof(SetupLevel), setupLevelDelay);
    }
 // Exit dungeon here
 public void ExitDungeon(SceneLoader.Scene scene)
 {
     SceneLoader.Load(scene);
 }