Ejemplo n.º 1
0
        public void DrawHealth()
        {
            PositionComponent pos = GetComponent <PositionComponent>();
            var       rect        = pos.GetRectangle();
            Character obj         = (Character)GameObject;
            var       health_rect = new Rectangle(rect.Left, rect.Bottom + 5, rect.Width, 5);

            GraphicsService.DrawGame(GameContent.Instance.whitePixel, health_rect, Color.Gray, rotation: pos.WorldPosition.RotationAngle, clamped_origin: Vector2.Zero);
            health_rect.Width = (int)(health_rect.Width * (obj.CurrentHitPoints / obj.MaxHitPoints));
            GraphicsService.DrawGame(GameContent.Instance.whitePixel, health_rect, Color.Red, rotation: pos.WorldPosition.RotationAngle, clamped_origin: Vector2.Zero);
        }