コード例 #1
0
        private void DrawBuildingFlame(double x, double y, double life, double maxLife, Sprite sprite, byte?alpha = null)
        {
            var healthK = life / maxLife;

            if (healthK < 0.51)
            {
                int numbers = Enum.GetValues(typeof(BigFlameSprite)).Cast <BigFlameSprite>().Count();
                sprite = Sprites.BigFlame((BigFlameSprite)((index / 2) % numbers));
            }
            else if (healthK < 0.75)
            {
                int numbers = Enum.GetValues(typeof(SmallFlameSprite)).Cast <SmallFlameSprite>().Count();
                sprite = Sprites.SmallFlame((SmallFlameSprite)((index / 2) % numbers));
            }
            if (alpha.HasValue)
            {
                sprite.Color = new Color(255, 255, 255, alpha.Value);
            }
            DrawGameUnitSprite(sprite, x, y);
        }