12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using UnityEngine;
- using UnityEngine.UI;
- public class FillBar : MonoBehaviour
- {
- [SerializeField] Image FillRequired;
- [SerializeField] Image FillCurrent;
- [SerializeField] private float requiredValue = 0.0f;
- [SerializeField] private float currentValue = 0.0f;
- [SerializeField] private bool isRequired = false;
- public float RequiredValue
- {
- get
- {
- return requiredValue;
- }
- set
- {
- requiredValue = value > 1.0f ? 1.0f : value < 0.0f ? 0.0f : value;
- FillRequired.fillAmount = requiredValue;
- }
- }
- public float CurrentValue
- {
- get
- {
- return currentValue;
- }
- set
- {
- currentValue = value > 1.0f ? 1.0f : value < 0.0f ? 0.0f : value;
- FillCurrent.fillAmount = currentValue;
- }
- }
- public bool ShowRequired
- {
- get
- {
- return isRequired;
- }
- set
- {
- isRequired = value;
- FillRequired.gameObject.SetActive(isRequired);
- }
- }
- }
|