Exemplo n.º 1
0
        public override void Render(BufferedGraphics g)
        {
            _sprite.Render(g, _graphicsTracker, LocationCenter);

            Enemy enemy = GetClosestEnemy();

            if (enemy != null && IsInRange(enemy))
            {
                PointF realCenter = _sprite.GetWindowLocation(_graphicsTracker, LocationCenter);

                g.Graphics.DrawLine(Pens.Crimson, realCenter, enemy.SpriteWithDirectionsRenderer.GetWindowLocation(_graphicsTracker, enemy.LocationCenter));
            }
        }
Exemplo n.º 2
0
        public override void Render(BufferedGraphics g)
        {
            if (IsVisible)
            {
                // Render the sprite. Returns the render coordiates.
                PointF renderCoords = SpriteWithDirectionsRenderer.Render(g, _graphicsTracker, LocationCenter);

                if (IsAlive)
                {
                    g.Graphics.DrawString($"{_health.Health:#.0}", _fontsAndColors.MonospaceFontSmaller,
                                          _fontsAndColors.BlueBrush, renderCoords.X, renderCoords.Y - 10);
                }
                else
                {
                    g.Graphics.DrawString("Aaaaarrrghhh!", _fontsAndColors.MonospaceFontSmaller,
                                          _fontsAndColors.BlackBrush, renderCoords.X - 35, renderCoords.Y - 20);
                }
            }
        }