Example #1
0
        protected override void Draw(GameTime gameTime)
        {
            if (gamestate == gameState.menu)
            {
                GraphicsDevice.Clear(Color.Olive);
                spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend);
                spriteBatch.DrawString(menuFont2, "PRISON BREAK!", new Vector2(420, 300), Color.Black);
                spriteBatch.DrawString(menuFont, "Press Enter to Play!", new Vector2(520, 450), Color.Black);
                spriteBatch.End();
            }
            else if (gamestate == gameState.play)
            {
                GraphicsDevice.Clear(Color.Olive);

                //Shader
                RenderTargetBinding[] tempBinding = GraphicsDevice.GetRenderTargets();
                GraphicsDevice.SetRenderTarget(tempRenderTarget);

                GraphicsDevice.Clear(Color.Olive);
                spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend);


                // Draw the runners.
                foreach (Runner mRunner in runnerList)
                {
                    mRunner.Draw(spriteBatch);
                }

                //Particle Engine
                particleEngine.Draw(spriteBatch);

                //HEli
                heli.Draw(spriteBatch);

                //Show Debug Info
                debugInfo.Draw(spriteBatch);


                spriteBatch.End();

                //SHader
                GraphicsDevice.SetRenderTargets(tempBinding);

                spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
                effect1.CurrentTechnique.Passes[0].Apply();


                spriteBatch.Draw(tempRenderTarget, Vector2.Zero, Color.White);
                spriteBatch.End();


                base.Draw(gameTime);
            }
            else
            {
                //end
                GraphicsDevice.Clear(Color.Olive);
                spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend);
                if (runnersRunning == 0)
                {
                    spriteBatch.DrawString(menuFont2, "Game Over - You Win!", new Vector2(360, 300), Color.Black);
                }
                else
                {
                    spriteBatch.DrawString(menuFont2, "Game Over - You Lose!", new Vector2(360, 300), Color.Black);
                }
                spriteBatch.DrawString(menuFont, "Score: " + Game1.score, new Vector2(370, 450), Color.Black);
                spriteBatch.DrawString(menuFont, "Escapees safe: " + Game1.runnersSafe, new Vector2(540, 450), Color.Black);
                spriteBatch.DrawString(menuFont, "Escapees caught: " + Runner.runnersCaught, new Vector2(790, 450), Color.Black);
                spriteBatch.End();
            }
        }