diff --git a/UnityProject/Assets/GameScripts/HotFix/GameLogic/Actor/ActorHItem.cs b/UnityProject/Assets/GameScripts/HotFix/GameLogic/Actor/ActorHItem.cs index 7bd8f7ce..a5b870d3 100644 --- a/UnityProject/Assets/GameScripts/HotFix/GameLogic/Actor/ActorHItem.cs +++ b/UnityProject/Assets/GameScripts/HotFix/GameLogic/Actor/ActorHItem.cs @@ -49,6 +49,7 @@ namespace GameLogic private Dictionary> m_Buffs = new Dictionary>(); //自身Buff列表 private int timerId = -1; + private float m_CurrentFillAmount = 0.1f; // 当前显示的进度条值 protected override void OnCreate() { @@ -484,29 +485,35 @@ namespace GameLogic /// public void UpdateScale() { - - if (DataGameSceneManager.Instance.m_TeamSortList.Count <= 0) - { + var teamList = DataGameSceneManager.Instance.m_TeamSortList; + if (teamList.Count <= 0) return; - } - // 获取当前第一名的值 - double oneNum = DataGameSceneManager.Instance.m_TeamSortList[0].GetAllPower(); + double oneNum = teamList[0].GetAllPower(); - if (oneNum == 0) + // 检查是否所有队伍都在初始状态 + bool allInit = true; + foreach (var team in teamList) { - m_imgValue.fillAmount = 0.1f; - AlignCarWithFillAmount(); - return; + if (team.GetAllPower() != oneNum) + { + allInit = false; + break; + } } - // 计算自己的百分比 - double percent = (float)m_AllPush / oneNum; - if (percent > 1) + float targetFill = 0.1f; + if (!allInit && oneNum > 0) { - 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(); }