High-performance C# ESP framework for Unity — 3D bounding boxes, 2D collider calculation, Animator skeleton bone tracking, and distance-scaled name tags.
main 1 Gwiazdy 0 Widelce 0 Obserwatorzy Zaktualizowano 3 days ago
C# 100%
Cała aktywność
Tylko wydania
Ignorować
unreliablecode / CSharp-Unity-ESP-Framework src/Renderers/NameTagRenderer.cs [Studio wizualne]
main CSHARP
NameTagRenderer.cs ×
CSharp-Unity-ESP-Framework / src / Renderers / NameTagRenderer.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using UnityEngine;
using CSharpESP.Drawing;

namespace CSharpESP.Renderers
{
    public class NameTagRenderer
    {
        public static void Render(
            Camera camera,
            Bounds bounds,
            string entityName,
            float currentHealth,
            float maxHealth,
            Color textColor)
        {
            if (!MathUtils.GetScreenRectFromBounds(camera, bounds, out Rect screenRect))
            {
                return;
            }

            float dist = MathUtils.GetDistance(camera, bounds.center);
            string labelText = $"{entityName} [{dist:F0}m]";

            // Draw text label centered above the bounding box
            Vector2 labelPos = new Vector2(screenRect.center.x, screenRect.yMin - 12f);
            RenderHelper.DrawString(labelPos, labelText, textColor, true);

            // Draw Health Bar if health parameters are valid
            if (maxHealth > 0f)
            {
                float healthPct = Mathf.Clamp01(currentHealth / maxHealth);
                float barWidth = Mathf.Max(30f, screenRect.width);
                float barHeight = 4f;
                float barX = screenRect.center.x - (barWidth / 2f);
                float barY = screenRect.yMin - 6f;

                // Background
                GUI.color = new Color(0f, 0f, 0f, 0.6f);
                GUI.DrawTexture(new Rect(barX, barY, barWidth, barHeight), RenderHelper.WhiteTexture);

                // Health Fill (interpolated green to red)
                Color healthColor = Color.Lerp(Color.red, Color.green, healthPct);
                GUI.color = healthColor;
                GUI.DrawTexture(new Rect(barX, barY, barWidth * healthPct, barHeight), RenderHelper.WhiteTexture);
                GUI.color = Color.white;
            }
        }
    }
}
main 0 błędów Gotowy
Ln 1, Kol 1 Kwestia: 49 Spacje: 4 UTF-8 CRLF CSHARP