Exemplo n.º 1
0
    public void SetState(ISceneState state, bool isLoadScene = true)
    {
        if (state == null)
        {
            return;
        }

        if (mState != null)
        {
            mState.Exit();
        }

        mState = state;

        if (isLoadScene)
        {
            // 异步加载场景
            mAO = SceneManager.LoadSceneAsync(mState.SceneName);

            mIsRunEnter = false;
        }
        else
        {
            //本身就在这个场景就无需加载场景了,例如: StartScene
            mState.Enter();

            mIsRunEnter = true;

            mAO = null;
        }
    }