using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; public class MovesAndTimeCounter : MonoBehaviour { [SerializeField] TextMeshProUGUI movesLabel; [SerializeField] string movesPrefix = "Ходы: "; [SerializeField] TextMeshProUGUI timeLabel; [SerializeField] string timePrefix = "Время: "; [SerializeField] List graphicsToVisibility; [SerializeField] int digitsAfterComma = 2; private bool visible = false; private GameManager gm; public void SetVisibility(bool visible) { this.visible = visible; foreach (Graphic g in graphicsToVisibility) { g.enabled = visible; } } public void Initialize() { SetVisibility(false); gm = GameManager.Instance; } void Update() { if (!visible) return; UpdateTime(); UpdateMoves(); } private void UpdateTime() { float time = gm.vsBotThinkTime; timeLabel.text = $"{timePrefix}{time.ToString($"F{digitsAfterComma}")}"; } private void UpdateMoves() { movesLabel.text = movesPrefix + gm.vsBotMoves; } }