using UnityEngine; public class GoalZone : MonoBehaviour { private void OnTriggerEnter(Collider other) { if (!other.CompareTag("Player")) { return; } UIManager uiManager = FindObjectOfType(); if (uiManager == null) { return; } int requiredScore = uiManager.TargetScore; if (uiManager.CurrentScore >= requiredScore) { uiManager.SetStatus("Цель достигнута"); Debug.Log("Goal reached with enough collectibles."); } else { uiManager.SetStatus($"Нужно собрать больше сфер: {uiManager.CurrentScore}/{requiredScore}."); Debug.Log("Goal reached, but not enough collectibles yet."); } } }