fix di chuyen update maze ui update map

This commit is contained in:
2026-04-22 13:22:42 +07:00
parent 666b4a5058
commit 0e6e763b64
11 changed files with 985 additions and 449 deletions

View File

@@ -0,0 +1,51 @@
using UnityEngine;
using TMPro;
using System.Collections;
namespace OnlyScove.Scripts.UI
{
public class MazeUI : MonoBehaviour
{
public static MazeUI Instance { get; private set; }
[Header("References")]
[SerializeField] private GameObject winPanel;
[SerializeField] private TextMeshProUGUI winMessageText;
[SerializeField] private TextMeshProUGUI timerText;
private void Awake()
{
if (Instance == null) Instance = this;
else Destroy(gameObject);
if (winPanel != null) winPanel.SetActive(false);
}
public void UpdateTimer(float time)
{
if (timerText != null)
timerText.text = $"Time: {time:F2}s";
}
public void ShowWinMessage(string playerName, float time)
{
if (winPanel == null) return;
winPanel.SetActive(true);
if (winMessageText != null)
{
winMessageText.text = $"<color=yellow>{playerName}</color>\nREACHED THE GOAL!\n<size=80%>IN {time:F2} SECONDS</size>";
}
// Tự động ẩn sau 5 giây
StopAllCoroutines();
StartCoroutine(HideWinPanel());
}
private IEnumerator HideWinPanel()
{
yield return new WaitForSeconds(5f);
winPanel.SetActive(false);
}
}
}