public override void Draw(GameTime gameTime, SpriteBatch spriteBatch) { _starField.Draw(gameTime, spriteBatch); _asteroidManager.Draw(gameTime, spriteBatch); _player.Draw(gameTime, spriteBatch); _shotManager.Draw(gameTime, spriteBatch); _enemyManager.Draw(gameTime, spriteBatch); _pieceExplosionManager.Draw(gameTime, spriteBatch); _pointExplosionManager.Draw(gameTime, spriteBatch); spriteBatch.DrawString(_perecles14, "Score " + _playerScore, _scoreLocation, Color.White); if (_player.RemainingLives > 0) { spriteBatch.DrawString(_perecles14, "Ships Remaining: " + _player.RemainingLives, _livesLocation, Color.White); } if (_gameOver) { const string GameOverText = "G A M E O V E R !"; Vector2 loc = new Vector2(ClientBounds.Width / 2 - _perecles14.MeasureString(GameOverText).X / 2, 50); spriteBatch.DrawString(_perecles14, GameOverText, loc, Color.White); } }
public void Draw(GameTime gameTime) { if (_projectileVertexList.Count > 0) { _projectileVertexBuffer = new VertexBuffer(_game.GraphicsDevice, typeof(VertexPositionColor), _projectileVertexList.Count, BufferUsage.WriteOnly); _projectileVertexBuffer.SetData <VertexPositionColor>(_projectileVertexList.ToArray()); //_game.GraphicsDevice.VertexDeclaration = _vertexDeclaration; //_game.GraphicsDevice.RenderState.CullMode = CullMode.None; // _game.GraphicsDevice.RenderState.DepthBufferEnable = true; // _game.GraphicsDevice.RenderState.DepthBufferWriteEnable = true; // _game.GraphicsDevice.RenderState.AlphaBlendEnable = false; _game.GraphicsDevice.RasterizerState = RasterizerState.CullNone; _game.GraphicsDevice.DepthStencilState = DepthStencilState.Default; _game.GraphicsDevice.BlendState = BlendState.Opaque; _projectileEffect.Parameters["World"].SetValue(Matrix.Identity); _projectileEffect.Parameters["View"].SetValue(_game.Camera.View); _projectileEffect.Parameters["Projection"].SetValue(_game.Camera.Projection); //_projectileEffect.Begin(); _projectileEffect.CurrentTechnique.Passes[0].Apply();// Begin(); //_game.GraphicsDevice.Vertices[0].SetSource(_projectileVertexBuffer, 0, VertexPositionColor.SizeInBytes); _game.GraphicsDevice.SetVertexBuffer(_projectileVertexBuffer); _game.GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, _projectileVertexBuffer.VertexCount / 3); //_projectileEffect.CurrentTechnique.Passes[0].End(); //_projectileEffect.End(); } _bazookaSmokeParticleSystem.Draw(gameTime); _explosionParticleSystem.Draw(gameTime); _explosionSmokeParticleSystem.Draw(gameTime); }