概述
设置常见的生命值条,
实现过程
设置UI/image作为形状
设置UI/Image作为背景
设置UI/image(healthfill)作为填充图片,层数低于背景
设置heathfill的imagetype为filled
fillmethod为horizontal
[SerializeField] private Image healthFill;public void AddHealth(int healAmount){health += healAmount;if (health > maxHealth)health = maxHealth;healthFill.fillAmount = health / maxHealth;}