public PlayingScene(Game game, Texture2D cross, Texture2D HUD) : base(game) { crossHair = cross; middle = new Vector2(base.Game.GraphicsDevice.Viewport.Width / 2 - 25, base.Game.GraphicsDevice.Viewport.Height / 2 - 25); //Components.Add(new ImageComponent(game, HUD, ImageComponent.DrawMode.Stretch)); spriteBatch = (SpriteBatch)Game.Services.GetService( typeof(SpriteBatch)); DebugShapeRenderer.Initialize(base.Game.GraphicsDevice); LoadModels(); g = game; hitCount = 0; deathCount = 0; }
public override void Draw(GameTime gameTime) { String s = ""; time = (float)((gameTime.TotalGameTime.TotalMilliseconds / 2000) % 2 * Math.PI); base.Game.GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, 1.0f, 0); DrawSkySphere(); base.Game.GraphicsDevice.DepthStencilState = DepthStencilState.Default; //Polygon culling level.DrawLevel(); s = DrawPlayers(s); Globals.blood.draw(); //rita ut blodsplatter base.Game.GraphicsDevice.Clear(ClearOptions.DepthBuffer, Color.Black, 1.0f, 0); //Rensar djupet i bilden DebugShapeRenderer.Draw(gameTime, Globals.player.camera.view, Globals.player.camera.projection); if (!Globals.player.alive) { spriteBatch.DrawString(Globals.deathFont, Globals.s, new Vector2(Constants.SCRWIDTH / 2 - 320, Constants.SCRHEIGHT / 3), Color.White); } spriteBatch.End(); spriteBatch.Begin(); Globals.muzzleflash.draw(); spriteBatch.End(); spriteBatch.Begin(); base.Game.GraphicsDevice.DepthStencilState = DepthStencilState.Default; //Polygon culling if (Globals.player.alive) { Globals.player.rifle.DrawGun(time); Globals.hud.DrawHUD(); spriteBatch.Draw(crossHair, middle, Color.Cyan); } spriteBatch.Draw(Globals.gotHitTexture, new Rectangle(0, 0, Constants.SCRWIDTH, Constants.SCRHEIGHT), Color.White * alpha); Globals.player.hitMe = false; base.Draw(gameTime); }