This commit is contained in:
CortexCore
2025-01-12 11:13:19 +08:00
parent 01e7e4e35e
commit 01b3d1be43
26 changed files with 387 additions and 336 deletions

View File

@@ -103,10 +103,11 @@ namespace BITKit
if (IsSyncContext)
{
await BITApp.SwitchToMainThread();
#if UNITY_EDITOR
await BITApp.SwitchToMainThread();
if (UnityEditor.EditorApplication.isPaused)
{
_timer.Interval = 1000d / TickRate;
_timer.Start();
return;
}
@@ -164,12 +165,19 @@ namespace BITKit
TickCount++;
if(_isDisposed)return;
_timer.Interval = 1000d / TickRate;
_timer.Start();
}
public bool IsSyncContext { get; set; } = true;
public ulong TickCount { get; set; }
public int TickRate { get; set; }
public int TickRate
{
get => _tickRate;
set => _tickRate = Math.Clamp(value, 1, int.MaxValue);
}
private int _tickRate;
public bool IsConcurrent { get; set; }
public event Func<float, UniTask> OnTickAsync;