Example #1
0
        public override void Draw(GameTime gameTime)
        {
            // Draw Background and clouds in seperate Spritebatch call without using View Matrix
            ScreenManager.SpriteBatch.Begin();

            _background.Draw(ScreenManager.SpriteBatch);
            _clouds.Draw(ScreenManager.SpriteBatch);
//             DrawDebug();
//             healthBar.Draw();
            ScreenManager.SpriteBatch.End();

            // Draw all background Objects in seperate Spritebatch call, else Background Objects will appear in front of the towers
            ScreenManager.SpriteBatch.Begin(0, null, null, null, null, null, Camera.View);
            foreach (StaticObject obj in StaticObject.Objects)
            {
                obj.Draw();
            }
            foreach (AnimatedObject obj in AnimatedObject.Objects)
            {
                obj.Draw();
            }
            // render eyes
            foreach (Eye eye in Eye.Eyes)
            {
                eye.Draw();
            }
            ScreenManager.SpriteBatch.End();



            ScreenManager.SpriteBatch.Begin(0, null, null, null, null, null, Camera.View);


            particleManager.Draw();

            // Render breakables Towers before Level part and their cannons before themselves
            foreach (PhysicBreakable breakable in physicBreakables)
            {
                if (breakable.WithCannon == true)
                {
                    breakable.cannon.Draw();
                }
            }

            foreach (PhysicBreakable breakable in physicBreakables)
            {
                breakable.Draw(gameTime);
            }

            // Render Actors
            level.Draw();

            // draw shots
            foreach (Shot shot in Shots)
            {
                shot.Draw();
            }

            // Render Level parts
            foreach (PhysicTexture tex in physicTextures)
            {
                tex.Draw();
            }



            // draw fadeup Texts
            fadeUp.Draw();

            // draw Bridges
            bridge1.Draw(0.3f);
            chainBridge1.Draw(0.2f);
            trap.Draw();

            ScreenManager.SpriteBatch.End();

            // Draw All UI stuff without using View Matrix
            ScreenManager.SpriteBatch.Begin();
            DrawDebug();
            healthBar.Draw();
            ScreenManager.SpriteBatch.End();


            base.Draw(gameTime);
        } // Draw