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

+45
View File
@@ -0,0 +1,45 @@
using UnityEngine;
/// <summary>Касса магазина автохимии на АЗС или ноутбук в гараже: [E] открывает магазин и склад.</summary>
public class ShopCounter : MonoBehaviour, IInteractable
{
[SerializeField] private Transform deliveryPoint;
[SerializeField] private string title = "Магазин автохимии и запчастей";
[SerializeField] private float nearbyRadius = 4f;
public static ShopCounter PlayerNearby { get; private set; }
public Transform DeliveryPoint => deliveryPoint;
private Transform player;
public void Configure(Transform delivery, string newTitle)
{
deliveryPoint = delivery;
title = newTitle;
}
private void Update()
{
if (player == null)
{
PlayerMovement pm = FindAnyObjectByType<PlayerMovement>();
if (pm != null) player = pm.transform;
}
bool near = player != null && player.gameObject.activeInHierarchy && Vector3.Distance(player.position, transform.position) < nearbyRadius;
if (near) PlayerNearby = this;
else if (PlayerNearby == this) PlayerNearby = null;
}
public string GetPrompt() => $"[E] {title} (также клавиша K)";
public void Interact(GameObject interactor)
{
GameEconomyManager eco = GameEconomyManager.Instance;
if (eco != null && !eco.DiplomaFeatures)
{
GameHUD.Notify("Магазин доступен в Дипломной версии", GameUI.Muted);
return;
}
if (GarageWarehouseUI.Instance != null) GarageWarehouseUI.Instance.Open(deliveryPoint);
}
}