First Commit

This commit is contained in:
bybohka committed 2026-11-19 23:24:44 +03:00
commit eed6b79efc
2836 files changed
+948481

No files matched your search

+43
View File
@@ -0,0 +1,43 @@
using UnityEngine;
/// <summary>Масляный щуп: при наведении показывает уровень и состояние моторного масла.</summary>
public class OilDipstick : MonoBehaviour, IInteractable
{
private CarFluids fluids;
private Vector3 restLocalPos;
private float pulledTimer;
private void Awake()
{
fluids = GetComponentInParent<CarFluids>();
restLocalPos = transform.localPosition;
}
private void Update()
{
if (pulledTimer > 0f) pulledTimer -= Time.deltaTime;
Vector3 target = restLocalPos + (pulledTimer > 0f ? Vector3.up * 0.14f : Vector3.zero);
transform.localPosition = Vector3.Lerp(transform.localPosition, target, Time.deltaTime * 8f);
}
public string GetPrompt()
{
if (fluids == null) fluids = GetComponentInParent<CarFluids>();
if (fluids == null) return "Масляный щуп";
CarFluids.FluidReservoir oil = fluids.EngineOil;
int level = Mathf.RoundToInt(oil.FillPercent * 100f);
int quality = Mathf.RoundToInt(oil.quality * 100f);
string qText = oil.currentLiters < 0.05f ? "масла нет!" : oil.QualityText;
string color = (oil.FillPercent < 0.5f || oil.quality < 0.5f) ? "#E5534B" : "#4CD07D";
return $"Масляный щуп [E] — вытащить\n<color={color}>Уровень: {level}% | Состояние: {quality}% ({qText})</color>";
}
public void Interact(GameObject interactor)
{
pulledTimer = 2.5f;
CarOwnership own = CarOwnership.Get(gameObject);
if (own != null) own.hoodInspected = true;
ProceduralAudioManager.Instance?.Play(SfxId.Pickup, transform.position, 0.6f);
}
}