Files
2026-05-25 20:45:05 +03:00

32 lines
827 B
C#

using UnityEngine;
public class GoalZone : MonoBehaviour
{
private void OnTriggerEnter(Collider other)
{
if (!other.CompareTag("Player"))
{
return;
}
UIManager uiManager = FindObjectOfType<UIManager>();
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.");
}
}
}