feat:1、添加项目

This commit is contained in:
2026-06-02 10:26:44 +08:00
commit dfead2c461
7518 changed files with 748693 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
namespace BallKingdomCrush
{
using System;
using UnityEngine;
public class Throttle
{
private float _lastTime;
private readonly float _interval;
public Throttle(float intervalSeconds)
{
_interval = intervalSeconds;
_lastTime = -intervalSeconds; // 确保一开始就能执行
}
/// <summary>
/// 节流调用:在时间窗口内只执行一次
/// </summary>
public void Execute(Action action)
{
if (Time.time - _lastTime >= _interval)
{
_lastTime = Time.time;
action?.Invoke();
}
}
}
}