20 lines
597 B
C#
20 lines
597 B
C#
using System;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
|
|
namespace UI {
|
|
public class UnitWorldUI : MonoBehaviour {
|
|
[SerializeField] private TextMeshProUGUI actionPointsText;
|
|
[SerializeField] private Unit unit;
|
|
|
|
private void Start() {
|
|
Unit.OnAnyActionPointsChanged += Unit_OnAnyActionPointsChanged;
|
|
UpdateActionPointsText();
|
|
}
|
|
|
|
private void Unit_OnAnyActionPointsChanged(object sender, EventArgs e) => UpdateActionPointsText();
|
|
|
|
private void UpdateActionPointsText() => actionPointsText.text = unit.ActionPoints.ToString();
|
|
}
|
|
}
|