public void Draw(SpriteBatch staticSpriteBatch, SpriteBatch cameraSpriteBatch) { //Draw projectiles foreach (Projectile projectile in projectiles.Values) { if (projectile != null) { // Draw projectiles projectile.Draw(cameraSpriteBatch); } } // Ship if (!invulnerable) { cameraSpriteBatch.Draw(texture, position, null, Color.White, playerRotation, origin, 1f, SpriteEffects.None, 0f); } else { cameraSpriteBatch.Draw(texture, position, null, Color.Red, playerRotation, origin, 1f, SpriteEffects.None, 0f); } // Shield cameraSpriteBatch.Draw(shield, position, null, Color.White, sheildRotation++, origin + new Vector2(3, 3), 1f, SpriteEffects.None, 0f); Color healthColor = Color.White; // Health if (health > 67) { healthColor = Color.LightGreen; } else if (health > 34) { healthColor = Color.Yellow; } else { healthColor = Color.PaleVioletRed; } if (playerControlled) { staticSpriteBatch.Draw(ContentStore.debug, new Vector2(6, 6), healthBar, healthColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); staticSpriteBatch.Draw(ContentStore.health_bar, new Vector2(4, 4), Color.White); // Name staticSpriteBatch.DrawString(ContentStore.generic, name, new Vector2(13, 7), Color.LightGray, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); // Debug if (SettingsManager.getShowDebug()) { staticSpriteBatch.DrawString(ContentStore.generic, "Health: " + health, Vector2.Zero, Color.White); staticSpriteBatch.DrawString(ContentStore.generic, "Position: " + position.ToString(), new Vector2(0, 16), Color.White); staticSpriteBatch.DrawString(ContentStore.generic, "Velocity: " + velocity.ToString(), new Vector2(0, 32), Color.White); staticSpriteBatch.DrawString(ContentStore.generic, "Direction: " + playerRotation, new Vector2(0, 48), Color.White); } if (SettingsManager.getShowBounds()) { // Collision rectangle cameraSpriteBatch.Draw(ContentStore.debug, bounds, Color.White); } } // Else draw a small health bar above player else { // Name Vector2 textOrigin = MoboUtils.textOrigin(name, ContentStore.generic); cameraSpriteBatch.DrawString(ContentStore.generic, name, position + new Vector2(0, -56), Color.White, 0.0f, textOrigin, 1f, SpriteEffects.None, 0.0f); // Health Bar cameraSpriteBatch.Draw(ContentStore.debug, position, new Rectangle(0, 0, fullBar.Width + 8, fullBar.Height + 8), Color.White, 0.0f, new Vector2(fullBar.Width / 2 + 4, 132), 0.25f, SpriteEffects.None, 0.0f); cameraSpriteBatch.Draw(ContentStore.debug, position, fullBar, Color.Black, 0.0f, new Vector2(fullBar.Width / 2, 128), 0.25f, SpriteEffects.None, 0.0f); cameraSpriteBatch.Draw(ContentStore.debug, position, healthBar, healthColor, 0.0f, new Vector2(healthBar.Width / 2, 128), 0.25f, SpriteEffects.None, 0.0f); } }