You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

54 lines
1.0 KiB

using UnityEngine;
using TMPro;
public enum PrizeIconType
{
COIN,
CRYSTAL,
ENERGY,
}
public class PrizeIcon : MonoBehaviour
{
[SerializeField] PrizeIconType _type;
[SerializeField] GameObject _coinIcon;
[SerializeField] GameObject _crystalIcon;
[SerializeField] GameObject _energyIcon;
[SerializeField] TextMeshProUGUI _countLabel;
[SerializeField] int _count;
void Start ()
{
InitIconByType();
}
void InitIconByType()
{
if (_type == PrizeIconType.COIN)
{
_crystalIcon.SetActive(false);
_energyIcon.SetActive(false);
}
else if (_type == PrizeIconType.CRYSTAL)
{
_coinIcon.SetActive(false);
_energyIcon.SetActive(false);
}
else if (_type == PrizeIconType.ENERGY)
{
_coinIcon.SetActive(false);
_crystalIcon.SetActive(false);
}
if (_countLabel)
_countLabel.text = _count.ToString();
}
void Update ()
{
}
}