using UnityEngine; using System; using TMPro; using System.Collections.Generic; public class ShipCounters : MonoBehaviour { public List Counters; public void Refresh(ScoreModel model) { if (Counters == null || Counters.Count == 0) return; foreach (var counter in Counters) { var modelCounter = model.GetCounterByType(counter.Type); if(modelCounter == null) { Debug.LogWarning($"Не найден счетчик с типом {counter.Type} в модели"); continue; } counter.CounterLabel.text = modelCounter.Count.ToString(); } } public void Initialize() { foreach (var counter in Counters) counter.CounterLabel.text = "0"; } [Serializable] public class ShipCounterByType { public EnemyShip.ShipType Type; public TextMeshProUGUI CounterLabel; } }