Added UI and more
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerHealthUIController : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private PlayerHealthView view;
|
||||
|
||||
private PlayerHealth playerHealth;
|
||||
|
||||
public void Bind(PlayerHealth _playerHealth)
|
||||
{
|
||||
playerHealth = _playerHealth;
|
||||
playerHealth.HealthChanged += OnHealthChanged;
|
||||
|
||||
playerHealth.PushCurrentHealthValue();
|
||||
}
|
||||
|
||||
public void OnHealthChanged(int _currentHealth, int _maxHealth)
|
||||
{
|
||||
view.UpdateHealth(_currentHealth, _maxHealth);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
playerHealth.HealthChanged -= OnHealthChanged;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user