Пользователь
- Статус
- Оффлайн
- Регистрация
- 13 Янв 2018
- Сообщения
- 198
- Реакции
- 75
Мб кому-то пригодится.
Отрисовка BoxRect'а
Отрисовка crosshair'а
Скрин прицела.
Отрисовка BoxRect'а
C#:
public static void BoxRect(Rect rect, Color color)
{
if (color != Render.color_0)
{
Render.texture2D_0.SetPixel(0, 0, color);
Render.texture2D_0.Apply();
Render.color_0 = color;
}
GUI.DrawTexture(rect, Render.texture2D_0);
}
private static Texture2D texture2D_0 = new Texture2D(1, 1);
private static Color color_0;
Отрисовка crosshair'а
C#:
public static bool Crosshair = false;
public static float CrosshairT = 1f;
public static float CrosshairL = 10f;
public static float CrosshairD = 10f;
public static byte CrosR = 255;
public static byte CrosG = 45;
public static byte CrosB = 45;
public static byte CrosA = 255;
public static void DrawCrosshair()
{
Color CrosshairColor = new Color32(CrosR, CrosG, CrosB, CrosA);
if (Crosshair == true)
{
Render.BoxRect(new Rect(Screen.width / 2f, Screen.height / 2f - CrosshairD + 1f, CrosshairT, -CrosshairL), CrosshairColor);
Render.BoxRect(new Rect(Screen.width / 2f, Screen.height / 2f + CrosshairD - 1f, CrosshairT, CrosshairL), CrosshairColor);
Render.BoxRect(new Rect(Screen.width / 2f, Screen.height / 2f - CrosshairD + 1f, -CrosshairT, -CrosshairL), CrosshairColor);
Render.BoxRect(new Rect(Screen.width / 2f, Screen.height / 2f + CrosshairD - 1f, -CrosshairT, CrosshairL), CrosshairColor);
Render.BoxRect(new Rect(Screen.width / 2f - CrosshairD + 1f, Screen.height / 2f, -CrosshairL, CrosshairT), CrosshairColor);
Render.BoxRect(new Rect(Screen.width / 2f + CrosshairD - 1f, Screen.height / 2f, CrosshairL, CrosshairT), CrosshairColor);
Render.BoxRect(new Rect(Screen.width / 2f - CrosshairD + 1f, Screen.height / 2f, -CrosshairL, -CrosshairT), CrosshairColor);
Render.BoxRect(new Rect(Screen.width / 2f + CrosshairD - 1f, Screen.height / 2f, CrosshairL, -CrosshairT), CrosshairColor);
}
}
Скрин прицела.
Последнее редактирование: