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.
31 lines
670 B
31 lines
670 B
using TMPro; |
|
using UnityEngine; |
|
using Utils; |
|
|
|
namespace Meta |
|
{ |
|
public class UiResources : MonoBehaviour |
|
{ |
|
|
|
[SerializeField] private RectTransform _expMask; |
|
[SerializeField] private float _expOffset; |
|
[SerializeField] private float _expWidth; |
|
[SerializeField] private TextMeshProUGUI _coinsText; |
|
|
|
private void OnEnable() |
|
{ |
|
PlayerResources.Instance.UiResources = this; |
|
} |
|
|
|
public void SetExp(int neededExp, int currentExp) |
|
{ |
|
var targetExp = currentExp / (float) neededExp; |
|
_expMask.SetRight(_expWidth - _expWidth * targetExp + _expOffset); |
|
} |
|
|
|
public void SetCoins(int coins) |
|
{ |
|
_coinsText.text = string.Format("{0}", coins); |
|
} |
|
} |
|
}
|
|
|