Допил интерфейса, здоровья, денег
This commit is contained in:
1 parent
b214bb0f63
commit
bea109175b
29 files changed
+675
-789
No files matched your search
@@ -0,0 +1,50 @@
|
||||
using Code.Gameplay.Player;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Code.UI
|
||||
{
|
||||
public class GameplayPanel : UIElement
|
||||
{
|
||||
[SerializeField] private Image healthBar;
|
||||
[SerializeField] private Image dispatcher;
|
||||
[SerializeField] private TMP_Text moneyText;
|
||||
[SerializeField] private TMP_Text timer;
|
||||
|
||||
private int _maxHealth;
|
||||
|
||||
public void Initialize(PlayerMoney money, PlayerHealth health)
|
||||
{
|
||||
money.OnMoneyGet += MoneyUpdate;
|
||||
money.OnMoneyLoose += MoneyUpdate;
|
||||
|
||||
moneyText.text = money.Money.ToString();
|
||||
|
||||
health.OnDamage += HealthUpdate;
|
||||
healthBar.fillAmount = (float)health.HealthPoints / _maxHealth * 100f;
|
||||
|
||||
_maxHealth = health.MaxHealthPoints;
|
||||
}
|
||||
private void MoneyUpdate(int count, int money)
|
||||
{
|
||||
// TODO Анимация получения\потери
|
||||
moneyText.text = money.ToString();
|
||||
}
|
||||
private void HealthUpdate(int count, int health)
|
||||
{
|
||||
// TODO Анимация потери
|
||||
healthBar.fillAmount = (float)health / _maxHealth * 100f;
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
timer.text = Time.deltaTime.ToString();
|
||||
}
|
||||
public void Hide()
|
||||
{
|
||||
}
|
||||
public void Show()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d79893d2e9024719924dc5c15d582e33
|
||||
timeCreated: 1761760839
|
||||
Reference in new issue
Block a user