コード例 #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");
        }
コード例 #2
0
ファイル: TestUtilties.cs プロジェクト: TheRaizer/FarmSim
    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");
    }
コード例 #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());
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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;
        }
コード例 #7
0
        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;
        }