Nez.SceneTransition.onBeginTransition C# (CSharp) Méthode

onBeginTransition() public méthode

called after the previousSceneRender occurs for the first (and only) time. At this point you can load your new Scene after yielding one frame (so the first render call happens before scene loading).
public onBeginTransition ( ) : IEnumerator
Résultat IEnumerator
		public virtual IEnumerator onBeginTransition()
		{
			yield return null;
			Core.scene = sceneLoadAction();
			transitionComplete();
		}

Usage Example

Exemple #1
0
        protected override void Draw(GameTime gameTime)
        {
            if (pauseOnFocusLost && !IsActive)
            {
                return;
            }

                        #if DEBUG
            TimeRuler.instance.beginMark("draw", Color.Gold);

            // fps counter
            _frameCounter++;
            _frameCounterElapsedTime += gameTime.ElapsedGameTime;
            if (_frameCounterElapsedTime >= TimeSpan.FromSeconds(1))
            {
                var totalMemory = (GC.GetTotalMemory(false) / 1048576f).ToString("F");
                Window.Title              = string.Format("{0} {1} fps - {2} MB", _windowTitle, _frameCounter, totalMemory);
                _frameCounter             = 0;
                _frameCounterElapsedTime -= TimeSpan.FromSeconds(1);
            }
                        #endif

            if (_sceneTransition != null)
            {
                _sceneTransition.preRender(Graphics.instance);
            }

            if (_scene != null)
            {
                _scene.render();

                                #if DEBUG
                if (debugRenderEnabled)
                {
                    Debug.render();
                }
                                #endif

                // render as usual if we dont have an active SceneTransition
                if (_sceneTransition == null)
                {
                    _scene.postRender();
                }
            }

            // special handling of SceneTransition if we have one
            if (_sceneTransition != null)
            {
                if (_scene != null && _sceneTransition.wantsPreviousSceneRender && !_sceneTransition.hasPreviousSceneRender)
                {
                    _scene.postRender(_sceneTransition.previousSceneRender);
                    if (_sceneTransition._loadsNewScene)
                    {
                        scene = null;
                    }
                    startCoroutine(_sceneTransition.onBeginTransition());
                }
                else if (_scene != null)
                {
                    _scene.postRender();
                }

                _sceneTransition.render(Graphics.instance);
            }

                        #if DEBUG
            TimeRuler.instance.endMark("draw");
            DebugConsole.instance.render();

            // the TimeRuler only needs to render when the DebugConsole is not open
            if (!DebugConsole.instance.isOpen)
            {
                TimeRuler.instance.render();
            }

                        #if !FNA
            drawCalls = graphicsDevice.Metrics.DrawCount;
                        #endif
                        #endif
        }
All Usage Examples Of Nez.SceneTransition::onBeginTransition