Пример #1
0
    public static async Task AsTask(this AsyncOperation asyncOperation)
    {
        if (asyncOperation == null)
        {
            return;
        }

        AsyncOperationWrapper wrapper = new AsyncOperationWrapper(asyncOperation);
        await wrapper.Task;
    }
Пример #2
0
        public void NextScene(int nextLevel)
        {
            Log.Assert(_asyncOp == null, "Scene transition already in progress!");
            Log.Debug("SceneTransition", "Set next level {0}", nextLevel);

            #if USE_UNITY_PRO
            asyncOp = Application.LoadLevelAsync(nextLevel); // TODO: Scene name or index!
            #else
            _asyncOp = new AsyncOperationWrapper(nextLevel);
            #endif
            _asyncOp.allowSceneActivation = false; // Should wait for the fade.
            audioPlayer.FadeOut(1f/4f);

            Animator a = this.gameObject.GetComponent<Animator>();
            a.Play("FadeOut");
        }