sea-battle-vr/Assets/Scripts/Awards/AwardsShipCounter.cs

24 lines
551 B
C#

using System.Linq;
using TMPro;
using UnityEngine;
public class AwardsShipCounter : MonoBehaviour
{
[SerializeField] private TextMeshProUGUI CountLabel;
[SerializeField] private EnemyShip.ShipType shipType;
public bool ShowScore(ScoreModel scoreModel)
{
var counter = scoreModel.ShipsCounters.FirstOrDefault(c => c.ShipType == shipType);
int count = 0;
if (counter != null)
count = counter.Count;
CountLabel.text = count.ToString();
return count > 0;
}
}