示例#1
0
        public static void DrawBagel(Graphics graphics, Entity entity, bool isDebugMode = false)
        {
            var bagel = entity as BagelEnemy;

            if (bagel == null)
            {
                return;
            }
            graphics.TranslateTransform(bagel.X, bagel.Y);
            graphics.RotateTransform(bagel.Direction);

            if (bagel.Health > 1)
            {
                DrawUtils.DrawCenteredBitmap(graphics,
                                             bagel.Health - 1 < DamagedBagelBitmapsAmount
                        ? DamagedBagelBitmaps[bagel.Health - 1]
                        : DamagedBagelBitmaps[DamagedBagelBitmaps.Length - 1]);
            }
            DrawUtils.DrawCenteredBitmap(graphics, BagelBitmaps[bagel.BagelType]);
            if (isDebugMode)
            {
                DrawUtils.DrawCollisionBox(graphics, bagel);
            }

            graphics.RotateTransform(-bagel.Direction);
            graphics.TranslateTransform(-bagel.X, -bagel.Y);
        }
        public static void DrawEntity(Graphics graphics, Entity entity, bool isDebugMode = false)
        {
            var texture = entity as ISingleTexture;

            if (texture == null)
            {
                return;
            }
            graphics.TranslateTransform(entity.X, entity.Y);
            graphics.RotateTransform(entity.Direction);

            if (Bitmaps.ContainsKey(texture.GetTextureFileName()))
            {
                var bitmap = Bitmaps[texture.GetTextureFileName()];
                DrawUtils.DrawCenteredBitmap(graphics, bitmap);
            }
            if (isDebugMode)
            {
                DrawUtils.DrawCollisionBox(graphics, entity);
            }

            graphics.RotateTransform(-entity.Direction);
            graphics.TranslateTransform(-entity.X, -entity.Y);
        }