Beispiel #1
0
    public SceneStateController(GameLoop gameLoop)
    {
        SceneStateBase.Controller = this;

        _gameLoop = gameLoop;
        _state    = SceneStateBase.CreateSceneState(GlobalDefine.LAUNCH_SCENE);
        _state.Init();
    }
Beispiel #2
0
    IEnumerator LoadScene(string sceneName)
    {
        var asyncOp = UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(sceneName);

        _isLoadingScene = true;

        while (!asyncOp.isDone)
        {
            yield return(null);
        }

        _state.Reclaim();

        var nextState = SceneStateBase.CreateSceneState(sceneName);

        nextState.Init();
        _state          = nextState;
        _isLoadingScene = true;
    }
Beispiel #3
0
    public static SceneStateBase CreateSceneState(string sceneName)
    {
        SceneStateBase sceneState = null;

        switch (sceneName)
        {
        case GlobalDefine.LAUNCH_SCENE:
            sceneState = new LaunchSceneState();
            break;

        case GlobalDefine.MENU_SCENE:
            sceneState = new MainMenuSceneState();
            break;

        case GlobalDefine.LEVEL_SCENE_1:
            sceneState = new Level1_SceneState();
            break;
        }

        return(sceneState);
    }