// Returns a Texture with a color based on the current Health of the entity. Texture2D healthTexture() { float healthPercentage = ((float)curHealth) / ((float)maxHealth); // Reach 0 a bit faster than standard if (healthPercentage < 0.2) { healthPercentage -= 0.1f; } if (healthPercentage < 0) { healthPercentage = 0; } return(ColoredTexture.generatePixel(r: 1 - healthPercentage, g: healthPercentage, b: 0)); }
// Initializes border and background textures. private void initTextures() { backgroundTexture = ColoredTexture.generatePixel(g: 255, b: 255); borderTexture = ColoredTexture.generatePixel(); clearTexture = ColoredTexture.generatePixel(a: 0); }