using System; using Code.GameplayServices; using TMPro; using UnityEngine; using UnityEngine.UI; namespace Code.UI { public class RestartPanel : MonoBehaviour { [SerializeField] private Button restartButton; [SerializeField] private TMP_Text scoreText; private void Awake() { restartButton.onClick.AddListener(RestartGame); } private void OnDestroy() { restartButton.onClick.RemoveListener(RestartGame); } private void OnEnable() { ShowScore(); } private void ShowScore() { scoreText.text = PlayerScoreService.Instance.Score.ToString(); } private void RestartGame() => GameplayManager.Instance.RestartGame(); } }