Пример #1
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, camera.Transform);    // Camera

            switch (currentGameState)
            {
            case gameStates.Waiting:
                spriteBatch.Draw(background, new Vector2(0, 0), Color.White);       // Background in character selection
                break;


            case gameStates.InGame:
                spriteBatch.Draw(gameBackground, new Vector2(-500, -500));                                              // Backgroind in game

                spriteBatch.Draw(_texture, _position, null, Color.White, rotation, _origin, 1f, SpriteEffects.None, 0); // Player drawn according to variables

                spriteBatch.DrawString(font, Convert.ToString("Ammo : " + ammoFont), fontPosition, Color.White);        // Font for ammo

                foreach (Projectiles projectile in projectiles)
                {
                    projectile.Draw(spriteBatch);
                }
                break;

            case gameStates.Main:
                mainMenu.Draw(spriteBatch, GraphicsDevice);
                break;

            case gameStates.Pause:
                pauseMenu.Draw(spriteBatch, font, _texture, currentUser, ammoFont, GraphicsDevice);
                break;
            }
            spriteBatch.End();

            base.Draw(gameTime);
        }