阶段性完成
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
using Cielonos.MainGame;
|
||||
using SLSFramework.General;
|
||||
using SLSFramework.UI;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI.Extensions.ColorPicker;
|
||||
|
||||
namespace Cielonos.UI
|
||||
{
|
||||
public class PlayerHealthBar : AttributeBarBase
|
||||
{
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
useLerpColor = true;
|
||||
fillColor = new LerpColor(GetTargetColor(1), 0.2f);
|
||||
}
|
||||
|
||||
public Color GetTargetColor(float ratio)
|
||||
{
|
||||
float hue = Mathf.Lerp(120f, 0f, 1 - ratio);
|
||||
return HSVUtil.ConvertHsvToRgb(hue, 0.41f, 1f, 1f);
|
||||
|
||||
/*if (ratio >= 0.9f)
|
||||
{
|
||||
return HSVUtil.ConvertHsvToRgb(120f, 0.41f, 1f, 1f);
|
||||
}
|
||||
else if(ratio >= 0.2f)
|
||||
{
|
||||
float hue = Mathf.Lerp(120f, 0f, (0.9f - ratio) / (0.9f - 0.2f));
|
||||
return HSVUtil.ConvertHsvToRgb(hue, 0.41f, 1f, 1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
return HSVUtil.ConvertHsvToRgb(0f, 0.41f, 1f, 1f);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user