/* * @Author: 白哉 * @Description: * @Date: 2025年07月01日 星期二 14:07:05 * @Modify: */ using JetBrains.Annotations; using Logic.CrashSight; using RuntimeData; using TH1_Anim.UnitAtomAnim; using TH1_DataAssetsScript; using TH1_Logic.Core; using TH1_Renderer; using TH1_Renderer.UnitAtomAnim; using TH1Renderer; using UnityEngine; namespace TH1_Anim.Fragments { public class FragmentCityExpUp : FragmentBase { public GridRenderer GridRenderer; public CityInfoRenderer CityInfoRenderer; public int Level; public int LevelExp; public bool IsDown; private float _step1_time; private bool _step1_bounce; public FragmentCityExpUp(FragmentCityExpUpData data) : base() { GridRenderer = data.GridRenderer; CityInfoRenderer = data.CityInfoRenderer; Level = data.Level; LevelExp = data.LevelExp; IsDown = data.IsDown; _step1_time = 0f; _step1_bounce = false; Duration = 0.2f; } public override bool CheckDone(float progressTime) { //超时保险 if (progressTime > Duration * 2) { Debug.Log($"Fragement Timeout {this.GetType()}"); return true; } if (!_step1_bounce) return false; if (progressTime <= Duration) return false; return true; } public override void OnUpdate(float progressTime) { //Step #1执行第一步,弹动,并且更新cityInfo的人口条部分和金钱部分 if (progressTime >= _step1_time && !_step1_bounce) { if (GridRenderer == null || CityInfoRenderer == null) { LogSystem.LogError($"Wrong With FragmentCityExpUp lv={Level},exp={LevelExp}"); _step1_bounce = true; return; } _step1_bounce = true; GridRenderer.SetBounceAnim(); CityInfoRenderer.UpdateLevelShow(Level,LevelExp); //如果是降级,或者Level <=0时的升级 可能会导致城市金币变化 if(IsDown || LevelExp <= 0)CityInfoRenderer.InstantUpdateCityGDP(); return; } } } }