public void Update(float pSeconds)
        {
            Escape();

            IntroFinished();
            mController0.UpdateController();
            mController1.UpdateController();
            bool tankMoved = false;

            foreach (Player p in m_Teams)
            {
                tankMoved = tankMoved | p.DoTankControls(pSeconds);
            }

            m_World.Update(pSeconds);

            m_World.CollideAllTheThingsWithPlayArea(mPlayAreaRectangle);

            if (tankMoved)
            {
                tankMoveSound.Play();
            }
            else
            {
                tankMoveSound.Pause();
            }
            List <int> remainingTeamsList = remainingTeams();

            if (remainingTeamsList.Count <= 1)
            {
                int winner = -1;
                if (remainingTeamsList.Count == 1)
                {
                    winner = remainingTeamsList[0];
                }
                Reset();
                Tankontroller.Instance().SM().Transition(new GameOverScene(mBackgroundTexture, m_Teams, winner));
            }

            m_SecondsTillTracksAdded -= pSeconds;
            if (m_SecondsTillTracksAdded <= 0)
            {
                m_SecondsTillTracksAdded += SECONDS_BETWEEN_TRACKS_ADDED;
                TrackSystem trackSystem = TrackSystem.GetInstance();
                foreach (Player p in m_Teams)
                {
                    trackSystem.AddTrack(p.Tank.GetWorldPosition(), p.Tank.GetRotation(), p.Tank.Colour());
                }
            }
        }
        public void Draw(float pSeconds)
        {
            Tankontroller.Instance().GDM().GraphicsDevice.Clear(Color.CornflowerBlue);

            m_SpriteBatch.Begin();

            m_SpriteBatch.Draw(mBackgroundTexture, mBackgroundRectangle, Color.White);

            foreach (Player player in m_Teams)
            {
                if (player.GUI != null)
                {
                    player.GUI.Draw(m_SpriteBatch);
                }
            }

            m_SpriteBatch.Draw(mPixelTexture, mPlayAreaOutlineRectangle, Color.Black);
            m_SpriteBatch.Draw(mPixelTexture, mPlayAreaRectangle, DGS.Instance.GetColour("COLOUR_GROUND"));

            TrackSystem.GetInstance().Draw(m_SpriteBatch);

            // bullet background
            int       bulletRadius = 10;
            int       radius       = bulletRadius + 2 * DGS.Instance.GetInt("PARTICLE_EDGE_THICKNESS");
            Rectangle bulletRect   = new Rectangle(0, 0, radius, radius);

            foreach (Player p in m_Teams)
            {
                List <Bullet> bullets = p.Tank.GetBulletList();
                foreach (Bullet b in bullets)
                {
                    bulletRect.X = (int)b.Position.X - radius / 2;
                    bulletRect.Y = (int)b.Position.Y - radius / 2;
                    m_SpriteBatch.Draw(m_BulletTexture, bulletRect, Color.Black);
                }
            }

            World.Particles.ParticleManager.Instance().Draw(m_SpriteBatch);

            // bullet colour
            bulletRect.Width  = bulletRadius;
            bulletRect.Height = bulletRadius;
            foreach (Player p in m_Teams)
            {
                List <Bullet> bullets = p.Tank.GetBulletList();
                foreach (Bullet b in bullets)
                {
                    bulletRect.X = (int)b.Position.X - bulletRadius / 2;
                    bulletRect.Y = (int)b.Position.Y - bulletRadius / 2;
                    m_SpriteBatch.Draw(m_BulletTexture, bulletRect, b.Colour);
                }
            }

            Rectangle trackRect = new Rectangle(0, 0, m_TankLeftTrackTexture.Width, m_TankLeftTrackTexture.Height / 15);

            float tankScale = (float)mPlayAreaRectangle.Width / (50 * 40);

            for (int i = 0; true; i++)
            {
                Tank t = m_World.GetTank(i);
                if (t == null)
                {
                    break;
                }
                if (t.Health() > 0)
                {
                    trackRect.Y = t.LeftTrackFrame() * m_TankLeftTrackTexture.Height / 15;
                    m_SpriteBatch.Draw(m_TankLeftTrackTexture, t.GetWorldPosition(), trackRect, t.Colour(), t.GetRotation(), new Vector2(m_TankBaseTexture.Width / 2, m_TankBaseTexture.Height / 2), tankScale, SpriteEffects.None, 0.0f);
                    trackRect.Y = t.RightTrackFrame() * m_TankLeftTrackTexture.Height / 15;
                    m_SpriteBatch.Draw(m_TankRightTrackTexture, t.GetWorldPosition(), trackRect, t.Colour(), t.GetRotation(), new Vector2(m_TankBaseTexture.Width / 2, m_TankBaseTexture.Height / 2), tankScale, SpriteEffects.None, 0.0f);
                    m_SpriteBatch.Draw(m_TankBaseTexture, t.GetWorldPosition(), null, t.Colour(), t.GetRotation(), new Vector2(m_TankBaseTexture.Width / 2, m_TankBaseTexture.Height / 2), tankScale, SpriteEffects.None, 0.0f);
                    if (t.Fired() == 0)
                    {
                        m_SpriteBatch.Draw(m_CannonTexture, t.GetCannonWorldPosition(), null, t.Colour(), t.GetCannonWorldRotation(), new Vector2(m_CannonTexture.Width / 2, m_CannonTexture.Height / 2), tankScale, SpriteEffects.None, 0.0f);
                    }
                    else
                    {
                        m_SpriteBatch.Draw(m_CannonFireTexture, t.GetCannonWorldPosition(), null, t.Colour(), t.GetCannonWorldRotation(), new Vector2(m_CannonTexture.Width / 2, m_CannonTexture.Height / 2), tankScale, SpriteEffects.None, 0.0f);
                    }
                }
                else
                {
                    m_SpriteBatch.Draw(m_TankBrokenTexture, t.GetWorldPosition(), null, t.Colour(), t.GetRotation(), new Vector2(m_TankBrokenTexture.Width / 2, m_TankBrokenTexture.Height / 2), tankScale, SpriteEffects.None, 0.0f);
                }
            }

            /*       Vector2 bulletOffset = new Vector2(m_BulletTexture.Width / 2, m_BulletTexture.Height / 2);
             *     foreach (Player p in m_Teams)
             *     {
             *         List<Bullet> bullets = p.Tank.GetBulletList();
             *         foreach (Bullet b in bullets)
             *         {
             *             m_SpriteBatch.Draw(m_BulletTexture, b.Position, null, p.Colour, 0, bulletOffset, 1f, SpriteEffects.None, 0.0f);
             *         }
             *     }
             */
            foreach (RectWall w in m_World.Walls)
            {
                w.DrawOutlines(m_SpriteBatch);
            }

            foreach (RectWall w in m_World.Walls)
            {
                w.Draw(m_SpriteBatch);
            }

            m_SpriteBatch.End();
        }