Add project files.
This commit is contained in:
27
Assets/Cryville/Common/Unity/UI/ProgressBar.cs
Normal file
27
Assets/Cryville/Common/Unity/UI/ProgressBar.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Cryville.Common.Unity.UI {
|
||||
public class ProgressBar : Slider {
|
||||
[SerializeField][Range(0f, 1f)]
|
||||
float m_smooth = 0;
|
||||
public float Smooth {
|
||||
get { return m_smooth; }
|
||||
set { m_smooth = value; }
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
float m_targetValue;
|
||||
public override float value {
|
||||
get { return base.value; }
|
||||
set { m_targetValue = value; }
|
||||
}
|
||||
|
||||
#pragma warning disable IDE0051
|
||||
protected override void Update() {
|
||||
base.value = (base.value - m_targetValue) * m_smooth + m_targetValue;
|
||||
base.Update();
|
||||
}
|
||||
#pragma warning restore IDE0051
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user