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

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

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

            if (_scene != null)
            {
                _scene.preRender();
                _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);
                    scene = null;
                    startCoroutine(_sceneTransition.onBeginTransition());
                }
                else
                {
                    if (_scene != null)
                    {
                        _scene.postRender();
                    }
                }

                _sceneTransition.render(Graphics.instance);
            }

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

            if (DebugConsole.instance.isOpen)
            {
                DebugConsole.instance.render();
            }
            else
            {
                TimeRuler.instance.render();
            }
                        #endif
        }