first commit
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user