Есть классы, есть двери, есть механика вселения, свага есть
This commit is contained in:
1 parent
2ae795c30a
commit
0f9a539460
69 files changed
+3960
-299
No files matched your search
@@ -5,49 +5,56 @@ namespace _Project.Scripts.PlayerUtils
|
||||
public class PlayerUI : MonoBehaviour
|
||||
{
|
||||
[Header("Настройки Интерфейса")]
|
||||
[SerializeField] private bool showSpeedometer = true;
|
||||
[SerializeField] private bool showHUD = true;
|
||||
|
||||
private PlayerMovement movement;
|
||||
private PlayerPossession possession;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
// Берем ссылку на компонент передвижения через фасад Player
|
||||
movement = Player.Instance.Movement;
|
||||
possession = Player.Instance.Possession;
|
||||
}
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
if (!showSpeedometer || movement == null) return;
|
||||
if (!showHUD || movement == null) return;
|
||||
|
||||
// Читаем публичное свойство скорости (мы добавим его ниже)
|
||||
float speed = movement.CurrentSpeed;
|
||||
float csUnits = speed * 38.5f;
|
||||
|
||||
GUIStyle style = new GUIStyle
|
||||
{
|
||||
fontSize = 24,
|
||||
fontStyle = FontStyle.Bold
|
||||
};
|
||||
GUIStyle style = new GUIStyle { fontSize = 22, fontStyle = FontStyle.Bold };
|
||||
|
||||
string state = "";
|
||||
if (movement.IsSliding) { style.normal.textColor = Color.yellow; state = " [SLIDE]"; }
|
||||
else if (!movement.IsGrounded) { style.normal.textColor = Color.green; state = " [AIR]"; }
|
||||
else style.normal.textColor = Color.white;
|
||||
|
||||
// Настраиваем цвет и текст состояния
|
||||
if (movement.IsSliding)
|
||||
{
|
||||
style.normal.textColor = Color.yellow;
|
||||
state = " [SLIDE]";
|
||||
}
|
||||
else if (!movement.IsGrounded)
|
||||
{
|
||||
style.normal.textColor = Color.green;
|
||||
state = " [AIR]";
|
||||
}
|
||||
else
|
||||
{
|
||||
style.normal.textColor = Color.white;
|
||||
}
|
||||
GUI.Label(new Rect(30, 30, 600, 40), $"Speed: {speed:F1} m/s ({csUnits:F0} u/s){state}", style);
|
||||
|
||||
GUI.Label(new Rect(30, 30, 500, 50), $"Speed: {speed:F1} m/s ({csUnits:F0} u/s){state}", style);
|
||||
if (possession != null && possession.CurrentProfile != null)
|
||||
{
|
||||
style.normal.textColor = possession.IsInSpiritForm ? Color.cyan : Color.green;
|
||||
string bodyInfo = $"Форма: {possession.CurrentProfile.displayName} | HP: {possession.CurrentHealth:F0}/{possession.MaxHealth:F0}";
|
||||
if (!possession.IsInSpiritForm) bodyInfo += " ([Q] Покинуть тело)";
|
||||
GUI.Label(new Rect(30, 65, 800, 40), bodyInfo, style);
|
||||
|
||||
if (possession.AimedEnemy != null)
|
||||
{
|
||||
if (possession.IsTargetInPossessZone)
|
||||
{
|
||||
style.normal.textColor = Color.cyan;
|
||||
GUI.Label(new Rect(Screen.width / 2f - 160f, Screen.height / 2f + 40f, 450f, 40f),
|
||||
$"[E] ВСЕЛИТЬСЯ: {possession.AimedEnemy.enemyClass}", style);
|
||||
}
|
||||
else
|
||||
{
|
||||
style.normal.textColor = new Color(1f, 0.5f, 0.5f);
|
||||
GUI.Label(new Rect(Screen.width / 2f - 180f, Screen.height / 2f + 40f, 500f, 40f),
|
||||
$"ДАЛЕКО — ВОЙДИ В СФЕРУ ({possession.AimedEnemy.enemyClass})", style);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user