88 lines
2.5 KiB
C#
88 lines
2.5 KiB
C#
/*
|
||
* @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 FragmentCityConnectExpUp : 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 FragmentCityConnectExpUp(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.4f;
|
||
|
||
}
|
||
|
||
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 FragmentCityConnectExpUp lv={Level},exp={LevelExp}");
|
||
_step1_bounce = true;
|
||
return;
|
||
}
|
||
|
||
MapRenderer.Instance.CameraController?.CameraFocusOnGrid(GridRenderer.Grid());
|
||
|
||
_step1_bounce = true;
|
||
GridRenderer.SetBounceAnim();
|
||
if(!IsDown)
|
||
GridRenderer.PlayVFX(new GridVFXParams(GridVFXType.CityConnect));
|
||
CityInfoRenderer.UpdateLevelShow(Level,LevelExp);
|
||
CityInfoRenderer.InstantUpdateCityLabels();
|
||
return;
|
||
}
|
||
|
||
|
||
}
|
||
}
|
||
} |