using UnityEngine;
using UnityEngine.UI;

public sealed class FuelUICounter : MonoBehaviour
{
    [SerializeField]
    private Text fuelLabel = null;
    [SerializeField]
    private Color usualColor = Color.white;
    [SerializeField]
    private Color noFuel = Color.red;
    [SerializeField]
    private int lowFuelCount = 2;
    [SerializeField]
    private string fuelText = "FUEL: ";
    [SerializeField]
    private string noFuelText = "NO FUEL";

    public void Show(int fuelCount, int maxCount) {
        fuelLabel.color = (fuelCount <= lowFuelCount) ? noFuel : usualColor;
        fuelLabel.text = (fuelCount > 0) ? $"{fuelText}{fuelCount}/{maxCount}" : noFuelText;
    }
}
