unreliablecode / CSharp-Unity-ESP-Framework
Publik
High-performance C# ESP framework for Unity โ 3D bounding boxes, 2D collider calculation, Animator skeleton bone tracking, and distance-scaled name tags.
main
1 Bintang
0 Garpu
0 Pengamat
Diperbarui 2 days ago
C#
100%
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
using UnityEngine;
namespace CSharpESP.Drawing
{
public static class RenderHelper
{
private static Texture2D s_WhiteTexture;
private static GUIStyle s_StringStyle;
public static Texture2D WhiteTexture
{
get
{
if (s_WhiteTexture == null)
{
s_WhiteTexture = new Texture2D(1, 1, TextureFormat.RGBA32, false);
s_WhiteTexture.SetPixel(0, 0, Color.white);
s_WhiteTexture.Apply();
}
return s_WhiteTexture;
}
}
public static GUIStyle StringStyle
{
get
{
if (s_StringStyle == null)
{
s_StringStyle = new GUIStyle(GUI.skin.label)
{
alignment = TextAnchor.MiddleCenter,
fontSize = 12,
fontStyle = FontStyle.Bold
};
s_StringStyle.normal.textColor = Color.white;
}
return s_StringStyle;
}
}
public static void DrawLine(Vector2 pointA, Vector2 pointB, Color color, float thickness = 1f)
{
Color oldColor = GUI.color;
GUI.color = color;
Vector2 diff = pointB - pointA;
float angle = Mathf.Rad2Deg * Mathf.Atan2(diff.y, diff.x);
float length = diff.magnitude;
GUIUtility.RotateAroundPivot(angle, pointA);
GUI.DrawTexture(new Rect(pointA.x, pointA.y - (thickness / 2f), length, thickness), WhiteTexture);
GUIUtility.RotateAroundPivot(-angle, pointA);
GUI.color = oldColor;
}
public static void DrawBox(Rect rect, Color color, float thickness = 1.5f)
{
DrawLine(new Vector2(rect.xMin, rect.yMin), new Vector2(rect.xMax, rect.yMin), color, thickness);
DrawLine(new Vector2(rect.xMax, rect.yMin), new Vector2(rect.xMax, rect.yMax), color, thickness);
DrawLine(new Vector2(rect.xMax, rect.yMax), new Vector2(rect.xMin, rect.yMax), color, thickness);
DrawLine(new Vector2(rect.xMin, rect.yMax), new Vector2(rect.xMin, rect.yMin), color, thickness);
}
public static void DrawCornerBox(Rect rect, Color color, float cornerLength = 8f, float thickness = 1.5f)
{
float w = Mathf.Min(cornerLength, rect.width / 3f);
float h = Mathf.Min(cornerLength, rect.height / 3f);
// Top-Left
DrawLine(new Vector2(rect.xMin, rect.yMin), new Vector2(rect.xMin + w, rect.yMin), color, thickness);
DrawLine(new Vector2(rect.xMin, rect.yMin), new Vector2(rect.xMin + h, rect.yMin), color, thickness);
// Top-Right
DrawLine(new Vector2(rect.xMax, rect.yMin), new Vector2(rect.xMax - w, rect.yMin), color, thickness);
DrawLine(new Vector2(rect.xMax, rect.yMin), new Vector2(rect.xMax + h, rect.yMin), color, thickness);
// Bottom-Left
DrawLine(new Vector2(rect.xMin, rect.yMax), new Vector2(rect.xMin + w, rect.yMax), color, thickness);
DrawLine(new Vector2(rect.xMin, rect.yMax), new Vector2(rect.xMin - h, rect.yMax), color, thickness);
// Bottom-Right
DrawLine(new Vector2(rect.xMax, rect.yMax), new Vector2(rect.xMax - w, rect.yMax), color, thickness);
DrawLine(new Vector2(rect.xMax, rect.yMax), new Vector2(rect.xMax - h, rect.yMax), color, thickness);
}
public static void DrawString(Vector2 pos, string text, Color color, bool centered = true)
{
GUIContent content = new GUIContent(text);
Vector2 size = StringStyle.CalcSize(content);
Rect r = centered ? new Rect(pos.x - (size.x / 2f), pos.y - (size.y / 2f), size.x, size.y) : new Rect(pos.x, pos.y, size.x, size.y);
// Drop shadow outline for high contrast
GUI.color = Color.black;
GUI.Label(new Rect(r.x - 1, r.y, r.width, r.height), content, StringStyle);
GUI.Label(new Rect(r.x + 1, r.y, r.width, r.height), content, StringStyle);
GUI.Label(new Rect(r.x, r.y - 1, r.width, r.height), content, StringStyle);
GUI.Label(new Rect(r.x, r.y + 1, r.width, r.height), content, StringStyle);
GUI.color = color;
GUI.Label(r, content, StringStyle);
GUI.color = Color.white;
}
}
}