Beispiel #1
0
        public void Draw(SpriteBatch spriteBatch, ContentManager Content, Player player, int playerNo, Player[] players)
        {
            spriteBatch.Draw(background, new Rectangle(0, 0, levelWidth, levelHeight), backgroundColor);

            foreach (Solid solid in backSolids)
            {
                solid.sprite.Draw(spriteBatch);
            }

            foreach (Drop drop in drops)
            {
                drop.Draw(spriteBatch, Content);
            }

            foreach (Solid solid in solids)
            {
                solid.sprite.Draw(spriteBatch);
            }

            foreach (Vector2 spawner in zombieSpawners)
            {
                spriteBatch.Draw(Content.Load <Texture2D>("ZombieSpawner"), spawner, Color.White);
            }

            if (zombies != null)
            {
                for (int i = 0; i < zombies.Length; i++)
                {
                    Zombie currentZombie = zombies[i];
                    currentZombie.Draw(spriteBatch);
                }
            }

            foreach (Player p in players)
            {
                if (p.isDead)
                {
                    spriteBatch.Draw(Content.Load <Texture2D>("GraveStone"), p.sprite.vector - new Vector2(p.sprite.getTexture().Width / 2, p.sprite.getTexture().Height / 2), Color.White);
                }
                else
                {
                    p.Draw(spriteBatch, Content);
                }
            }

            foreach (Particle particle in bloodParticles)
            {
                particle.Draw(spriteBatch, Content);
            }

            foreach (BasicWeaponBullet bullet in basicWeaponBullets)
            {
                bullet.Draw(spriteBatch);
            }

            foreach (Rocket rocket in rockets)
            {
                rocket.Draw(spriteBatch, Content);
            }

            if (zombies != null)
            {
                for (int i = 0; i < zombies.Length; i++)
                {
                    if (playerNo == 1)
                    {
                        if (CHZ.options.player1CameraRotation)
                        {
                            String  health       = zombies[i].health.ToString();
                            Vector2 healthOrigin = zombies[i].Font.MeasureString(health) / 2;
                            spriteBatch.DrawString(zombies[i].Font, health, CHZ.RotateVector2(new Vector2(zombies[i].sprite.getX(), zombies[i].sprite.getY() + zombies[i].sprite.getTexture().Height / 4 * 3), player.playerRotation, new Vector2(zombies[i].sprite.getX(), zombies[i].sprite.getY())), Color.Black, player.playerRotation, healthOrigin, 1.0f, SpriteEffects.None, 0.5f);
                        }
                        else
                        {
                            String  health       = zombies[i].health.ToString();
                            Vector2 healthOrigin = zombies[i].Font.MeasureString(health) / 2;
                            spriteBatch.DrawString(zombies[i].Font, health, new Vector2(zombies[i].sprite.getX(), zombies[i].sprite.getY() + zombies[i].sprite.getTexture().Height / 4 * 3), Color.Black, 0, healthOrigin, 1.0f, SpriteEffects.None, 0.5f);
                        }
                    }
                    else if (playerNo == 2)
                    {
                        if (CHZ.options.player2CameraRotation)
                        {
                            String  health       = zombies[i].health.ToString();
                            Vector2 healthOrigin = zombies[i].Font.MeasureString(health) / 2;
                            spriteBatch.DrawString(zombies[i].Font, health, CHZ.RotateVector2(new Vector2(zombies[i].sprite.getX(), zombies[i].sprite.getY() + zombies[i].sprite.getTexture().Height / 4 * 3), player.playerRotation, new Vector2(zombies[i].sprite.getX(), zombies[i].sprite.getY())), Color.Black, player.playerRotation, healthOrigin, 1.0f, SpriteEffects.None, 0.5f);
                        }
                        else
                        {
                            String  health       = zombies[i].health.ToString();
                            Vector2 healthOrigin = zombies[i].Font.MeasureString(health) / 2;
                            spriteBatch.DrawString(zombies[i].Font, health, new Vector2(zombies[i].sprite.getX(), zombies[i].sprite.getY() + zombies[i].sprite.getTexture().Height / 4 * 3), Color.Black, 0, healthOrigin, 1.0f, SpriteEffects.None, 0.5f);
                        }
                    }
                }
            }

            foreach (Solid solid in foreSolids)
            {
                solid.sprite.Draw(spriteBatch);
            }
        }
Beispiel #2
0
        public void DrawWithoutHealth(SpriteBatch spriteBatch, ContentManager Content, Player[] players)
        {
            spriteBatch.Draw(background, new Rectangle(0, 0, levelWidth, levelHeight), backgroundColor);

            foreach (Solid solid in backSolids)
            {
                solid.sprite.Draw(spriteBatch);
            }

            foreach (Drop drop in drops)
            {
                drop.Draw(spriteBatch, Content);
            }

            foreach (Solid solid in solids)
            {
                solid.sprite.Draw(spriteBatch);
            }

            foreach (Vector2 spawner in zombieSpawners)
            {
                spriteBatch.Draw(Content.Load <Texture2D>("ZombieSpawner"), spawner, Color.White);
            }

            foreach (Player p in players)
            {
                if (p.isDead)
                {
                    spriteBatch.Draw(Content.Load <Texture2D>("GraveStone"), p.sprite.vector - new Vector2(p.sprite.getTexture().Width / 2, p.sprite.getTexture().Height / 2), Color.White);
                }
                else
                {
                    p.Draw(spriteBatch, Content);
                }
            }

            for (int i = 0; i < zombies.Length; i++)
            {
                Zombie currentZombie = zombies[i];
                currentZombie.Draw(spriteBatch);
            }

            foreach (Particle particle in bloodParticles)
            {
                particle.Draw(spriteBatch, Content);
            }

            foreach (BasicWeaponBullet bullet in basicWeaponBullets)
            {
                bullet.Draw(spriteBatch);
            }

            foreach (Rocket rocket in rockets)
            {
                rocket.Draw(spriteBatch, Content);
            }

            foreach (Solid solid in foreSolids)
            {
                solid.sprite.Draw(spriteBatch);
            }
        }