Esempio n. 1
0
        public static IEnumerator AssertSceneLoaded(string sceneName)
        {
            var waitForScene = new WaitForSceneLoaded(sceneName);

            yield return(waitForScene);

            Assert.IsFalse(waitForScene.TimedOut, "Scene " + sceneName + " was never loaded");
        }
Esempio n. 2
0
    public static IEnumerator AssertSceneLoaded(string scenePath)
    {
        var waitForScene = new WaitForSceneLoaded(scenePath);

        yield return(waitForScene);

        Assert.IsFalse(waitForScene.TimedOut, "Scene at path (" + scenePath + ") was never loaded");
    }
Esempio n. 3
0
        public IEnumerator ResetScene()
        {
            SceneManager.LoadScene(sceneName, LoadSceneMode.Single);
            var waitForScene = new WaitForSceneLoaded(sceneName);

            yield return(waitForScene);

            gridHandler             = GameObject.Find("Grid")?.GetComponent <GridHandler>();
            inputHandler            = GameObject.Find("Grid")?.GetComponent <InputHandler>();
            gridHandler.isTestSetup = true;
            gridHandler.ResetGrid();
            yield return(new WaitForFixedUpdate());
        }
        public IRadicalYieldInstruction Unload()
        {
            IRadicalYieldInstruction arg = null;

            if (_loadingOp != null)
            {
                var op = _loadingOp;
                _loadingOp = null;

                op.Cancel();
                if (_currentSceneBehaviour != null)
                {
                    if (op.LastScene == _currentSceneBehaviour)
                    {
                        _currentSceneBehaviour = null;
                    }
                    else
                    {
                        arg = _currentSceneBehaviour.EndScene();
                        if (arg != null)
                        {
                            _lastSceneBehaviour = _currentSceneBehaviour;
                            arg = this.StartRadicalCoroutine(this.ForceUnloadRoutine(arg, _lastSceneBehaviour));
                        }
                    }
                }
            }
            else if (_currentSceneBehaviour != null)
            {
                _currentSceneBehaviour.EndScene();
                if (_currentSceneBehaviour.gameObject != null)
                {
                    ObjUtil.SmartDestroy(_currentSceneBehaviour.gameObject);
                }
            }

            _currentSceneBehaviour = null;
            return(arg);
        }
        public IProgressingYieldInstruction LoadScene(ISceneLoadOptions options)
        {
            if (options == null)
            {
                throw new System.ArgumentNullException("options");
            }

            if (_loadingOp != null)
            {
                _loadingOp.Cancel();
                if (!_loadingOp.NextSceneStarted)
                {
                    _currentSceneBehaviour = null;
                }
                _loadingOp = null;
            }

            _lastSceneBehaviour    = _currentSceneBehaviour;
            _currentSceneBehaviour = null;
            _loadingOp             = new WaitForSceneLoaded();
            _loadingOp.Start(this, options, _lastSceneBehaviour);
            return(_loadingOp);
        }
        public IRadicalYieldInstruction Unload()
        {
            IRadicalYieldInstruction arg = null;

            if (_loadingOp != null)
            {
                var op = _loadingOp;
                _loadingOp = null;

                op.Cancel();
                if(_currentSceneBehaviour != null)
                {
                    if(op.LastScene == _currentSceneBehaviour)
                    {
                        _currentSceneBehaviour = null;
                    }
                    else
                    {
                        arg = _currentSceneBehaviour.EndScene();
                        if(arg != null)
                        {
                            _lastSceneBehaviour = _currentSceneBehaviour;
                            arg = this.StartRadicalCoroutine(this.ForceUnloadRoutine(arg, _lastSceneBehaviour));
                        }
                    }
                }
            }
            else if (_currentSceneBehaviour != null)
            {
                _currentSceneBehaviour.EndScene();
                if (_currentSceneBehaviour.gameObject != null) ObjUtil.SmartDestroy(_currentSceneBehaviour.gameObject);
            }

            _currentSceneBehaviour = null;
            return arg;
        }
        public IProgressingYieldInstruction LoadScene(ISceneLoadOptions options)
        {
            if (options == null) throw new System.ArgumentNullException("options");

            if (_loadingOp != null)
            {
                _loadingOp.Cancel();
                if (!_loadingOp.NextSceneStarted) _currentSceneBehaviour = null;
                _loadingOp = null;
            }

            _lastSceneBehaviour = _currentSceneBehaviour;
            _currentSceneBehaviour = null;
            _loadingOp = new WaitForSceneLoaded();
            _loadingOp.Start(this, options, _lastSceneBehaviour);
            return _loadingOp;
        }