Одержимость от первого лица: свой пояс зомби на 2 ячейки (пока пустой), выбор 1/2 и колесом

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
AlexCube
2026-10-13 16:20:12 +03:00
co-authored by Claude Opus 5.5
parent c537ec897f
commit 7b63f91a3b
3 changed files with 52 additions and 0 deletions
+52
View File
@@ -147,6 +147,9 @@ namespace NecromancerTome
/// (QuickMenu, по умолчанию Backquote; и CameraChange геймпада), каждое вселение начинается от третьего лица. Камера - в голове, тело - только тень
/// (HideBody), положение глаз сглажено (FpSmooth) - голова зомби на ходу мотается.</summary>
public static bool FirstPerson;
/// <summary>Пояс одержимого (13.10): 2 ячейки, пока пустые; выбор 1/2 или колесом, только от первого лица.</summary>
public const int BeltSlots = 2;
public static int BeltSlot;
public const float FpForward = 0.12f, FpSmooth = 12f;
static Vector3 _fpEye;
static readonly List<Renderer> _hiddenRenderers = new List<Renderer>();
@@ -313,6 +316,7 @@ namespace NecromancerTome
_nextScream = 0f;
_loggedCamera = false;
FirstPerson = false;
BeltSlot = 0;
// Пояс одержимому питомцу ни к чему (указание 06.10); открыться заново не даёт
// Patch_GUIWindowManager_openInternal_SnakeToolbelt, после выхода игра откроет его сама.
if (_pet)
@@ -602,6 +606,26 @@ namespace NecromancerTome
}
Debug.Log("[NecromancerTome] Possession: вид от " + (FirstPerson ? "первого" : "третьего") + " лица");
}
if (FirstPerson && input != null && !gui)
{
int was = BeltSlot;
if (input.InventorySlot1.WasPressed)
{
BeltSlot = 0;
}
else if (input.InventorySlot2.WasPressed)
{
BeltSlot = 1;
}
else if (input.ScrollUp.WasPressed || input.ScrollDown.WasPressed)
{
BeltSlot = (BeltSlot + 1) % BeltSlots;
}
if (BeltSlot != was)
{
Debug.Log("[NecromancerTome] Possession: пояс - ячейка " + (BeltSlot + 1));
}
}
if (input != null && !gui && input.ToggleCrouch.WasPressed)
{
_crouchToggled = !_crouchToggled;
@@ -2417,6 +2441,10 @@ namespace NecromancerTome
_style = new GUIStyle(GUI.skin.label) { alignment = TextAnchor.MiddleLeft, clipping = TextClipping.Clip };
_style.normal.textColor = new Color(0.95f, 0.9f, 0.85f);
}
if (Possession.FirstPerson)
{
DrawBelt(scale);
}
Rect hr;
// Справа от полосок игрока, а не поверх (указание 13.10: «можем вывести где-нибудь и здоровье игрока»):
// над ними значки баффов, справа до панели предметов пусто.
@@ -2493,6 +2521,30 @@ namespace NecromancerTome
}
}
/// <summary>Пояс одержимого от первого лица (указание 13.10: «собственный пояс на 2 ячейки», пока пустой) - на месте
/// пояса персонажа, внизу по центру; выбранная ячейка в рамке. Ячейки пустые - бьёт кулаками.</summary>
static void DrawBelt(float _scale)
{
float size = 64f * _scale, gap = 6f * _scale, frame = 3f * _scale;
float x0 = (Screen.width - (size * Possession.BeltSlots + gap * (Possession.BeltSlots - 1))) / 2f;
float y = Screen.height - 14f * _scale - size;
Color prev = GUI.color;
for (int i = 0; i < Possession.BeltSlots; i++)
{
Rect r = new Rect(x0 + i * (size + gap), y, size, size);
if (i == Possession.BeltSlot)
{
GUI.color = CdReady;
GUI.DrawTexture(new Rect(r.x - frame, r.y - frame, r.width + frame * 2f, r.height + frame * 2f), Texture2D.whiteTexture);
}
GUI.color = Back;
GUI.DrawTexture(r, Texture2D.whiteTexture);
GUI.color = prev;
GUI.Label(new Rect(r.x + 4f * _scale, r.y + 2f * _scale, r.width, 18f * _scale), (i + 1).ToString(), _style);
}
GUI.color = prev;
}
static void DrawBar(Rect _r, float _frac, Color _fill, string _text)
{
Color prev = GUI.color;