WaveEngine.Components.Transitions.ColorFadeTransition.Draw C# (CSharp) Method

Draw() protected method

Draws the specified game time.
protected Draw ( System.TimeSpan gameTime ) : void
gameTime System.TimeSpan The game time.
return void
        protected override void Draw(TimeSpan gameTime)
        {
            if (this.Sources != null)
            {
                for (int i = 0; i < this.Sources.Length; i++)
                {
                    var stackedContext = this.Sources[i];

                    if ((stackedContext.Behavior & ScreenContextBehaviors.DrawInBackground) != 0)
                    {
                        stackedContext.Draw(gameTime);
                    }
                }
            }

            if (this.Lerp > 0.5f)
            {
                this.Target.Draw(gameTime);
            }

            float factor = (this.Lerp <= 0.5f) ? 2 * this.Lerp : 1 - (2 * (this.Lerp - 0.5f));
            Color blendColor = this.transitionColor * factor;

            this.SetRenderState();
            this.graphicsDevice.RenderTargets.SetRenderTarget(null);
            this.spriteBatch.Draw(StaticResources.WhitePixel, new Rectangle(0, 0, this.platform.ScreenWidth, this.platform.ScreenHeight), null, blendColor, 0, Vector2.Zero, SpriteEffects.None, 0);
            this.spriteBatch.Render();
        }