/* * If you like my work, and found it useful * Please donate * Bitcoin Address: 1LdyAQHXdFVqzGzah45sGKhsQ8wDE6jyci * Good luck and enjoy. * */ using UnityEngine; namespace Assets.Scripts { public class ProgressBar { private readonly GameObject _gameObject; private float _value; public Color BackGroundColor { get; set; } public Color ForeGroundColor { get; set; } public float MaxValue { get; set; } public Vector2 Position { get; set; } public Vector2 Size { get; set; } public bool IsEnabled { get { return _gameObject.activeSelf; } set{_gameObject.SetActive(value);}} public bool IsVertical { get; set; } public float Value { get { return _value; } set { _value = Mathf.Clamp(value, 0, MaxValue); } } public ProgressBar() { _gameObject = new GameObject(); _gameObject.AddComponent().Init(this); } public void Destroy() { Object.Destroy(_gameObject); } } }