102 lines
2.6 KiB
C#
102 lines
2.6 KiB
C#
/*
|
|
* @Author: 白哉
|
|
* @Description:
|
|
* @Date: 2025年07月01日 星期二 14:07:05
|
|
* @Modify:
|
|
*/
|
|
|
|
|
|
using JetBrains.Annotations;
|
|
using RuntimeData;
|
|
using TH1_Anim.UnitAtomAnim;
|
|
using TH1_DataAssetsScript;
|
|
using TH1_Logic.Core;
|
|
using TH1_Renderer.UnitAtomAnim;
|
|
using TH1Renderer;
|
|
using UnityEngine;
|
|
|
|
namespace TH1_Anim.Fragments
|
|
{
|
|
public enum GridUpdateType
|
|
{
|
|
None,
|
|
FogDisappear,
|
|
BuildingUpdate,
|
|
BuildingDestroy,
|
|
Treasure
|
|
|
|
}
|
|
|
|
public class FragmentGridUpdate : FragmentBase
|
|
{
|
|
public GridUpdateType Type;
|
|
public GridRenderer GridRenderer;
|
|
private float _step1_time;
|
|
private float _step2_time;
|
|
private bool _step1_start;
|
|
private bool _step2_end;
|
|
|
|
|
|
public FragmentGridUpdate(FragmentGridUpdateData data) : base()
|
|
{
|
|
Type = data.GridUpdateType;
|
|
GridRenderer = data.GridRenderer;
|
|
_step1_time = 0f;
|
|
_step2_time = Type switch
|
|
{
|
|
GridUpdateType.FogDisappear => data.Duration,
|
|
GridUpdateType.BuildingUpdate => 0.1f,
|
|
GridUpdateType.BuildingDestroy => 0.1f,
|
|
GridUpdateType.Treasure => 0.1f,
|
|
_ => 0.05f
|
|
};
|
|
|
|
_step1_start = false;
|
|
_step2_end = false;
|
|
|
|
Duration = _step2_time;
|
|
|
|
}
|
|
|
|
public override bool CheckDone(float progressTime)
|
|
{
|
|
if (!_step1_start || !_step2_end) return false;
|
|
if (progressTime <= Duration)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
|
|
public override void OnUpdate(float progressTime)
|
|
{
|
|
//Step #1执行第一步
|
|
if (progressTime >= _step1_time && !_step1_start)
|
|
{
|
|
_step1_start = true;
|
|
//近战攻击
|
|
switch (Type)
|
|
{
|
|
case GridUpdateType.FogDisappear:
|
|
GridRenderer.FirstShowGrid();
|
|
break;
|
|
case GridUpdateType.BuildingUpdate:
|
|
break;
|
|
case GridUpdateType.BuildingDestroy:
|
|
break;
|
|
case GridUpdateType.Treasure:
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
return;
|
|
}
|
|
|
|
if (progressTime >= _step2_time && !_step2_end)
|
|
{
|
|
_step2_end = true;
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
} |