35 lines
855 B
C#
35 lines
855 B
C#
using System.Linq;
|
||
using TMPro;
|
||
using UnityEngine;
|
||
|
||
public class AwardsShipCounter : MonoBehaviour
|
||
{
|
||
[SerializeField] private TextMeshProUGUI CountLabel;
|
||
[SerializeField] private EnemyShip.ShipType shipType;
|
||
[SerializeField] private CanvasGroup canvasGroup;
|
||
|
||
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;
|
||
}
|
||
|
||
public void SetAlpha(float alpha)
|
||
{
|
||
if(canvasGroup == null)
|
||
{
|
||
Debug.LogError("Не назначена канвас группа", this);
|
||
return;
|
||
}
|
||
canvasGroup.alpha = alpha;
|
||
}
|
||
|
||
|
||
}
|