1
This commit is contained in:
parent
41accf40ff
commit
2634ec9bb6
@ -49,6 +49,7 @@ namespace GameLogic
|
|||||||
private Dictionary<string, List<Buff>> m_Buffs = new Dictionary<string, List<Buff>>(); //自身Buff列表
|
private Dictionary<string, List<Buff>> m_Buffs = new Dictionary<string, List<Buff>>(); //自身Buff列表
|
||||||
|
|
||||||
private int timerId = -1;
|
private int timerId = -1;
|
||||||
|
private float m_CurrentFillAmount = 0.1f; // 当前显示的进度条值
|
||||||
|
|
||||||
protected override void OnCreate()
|
protected override void OnCreate()
|
||||||
{
|
{
|
||||||
@ -484,29 +485,35 @@ namespace GameLogic
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void UpdateScale()
|
public void UpdateScale()
|
||||||
{
|
{
|
||||||
|
var teamList = DataGameSceneManager.Instance.m_TeamSortList;
|
||||||
if (DataGameSceneManager.Instance.m_TeamSortList.Count <= 0)
|
if (teamList.Count <= 0)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// 获取当前第一名的值
|
double oneNum = teamList[0].GetAllPower();
|
||||||
double oneNum = DataGameSceneManager.Instance.m_TeamSortList[0].GetAllPower();
|
|
||||||
|
|
||||||
if (oneNum == 0)
|
// 检查是否所有队伍都在初始状态
|
||||||
|
bool allInit = true;
|
||||||
|
foreach (var team in teamList)
|
||||||
{
|
{
|
||||||
m_imgValue.fillAmount = 0.1f;
|
if (team.GetAllPower() != oneNum)
|
||||||
AlignCarWithFillAmount();
|
{
|
||||||
return;
|
allInit = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 计算自己的百分比
|
float targetFill = 0.1f;
|
||||||
double percent = (float)m_AllPush / oneNum;
|
if (!allInit && oneNum > 0)
|
||||||
if (percent > 1)
|
|
||||||
{
|
{
|
||||||
percent = 1;
|
double percent = m_AllPush / oneNum;
|
||||||
|
if (percent > 1) percent = 1;
|
||||||
|
if (percent < 0.1) percent = 0.1;
|
||||||
|
targetFill = (float)percent;
|
||||||
}
|
}
|
||||||
m_imgValue.fillAmount = (float)percent;
|
|
||||||
|
// 平滑过渡
|
||||||
|
m_CurrentFillAmount = Mathf.Lerp(m_CurrentFillAmount, targetFill, Time.deltaTime * 8f);
|
||||||
|
m_imgValue.fillAmount = m_CurrentFillAmount;
|
||||||
AlignCarWithFillAmount();
|
AlignCarWithFillAmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user