1
This commit is contained in:
@@ -22,6 +22,10 @@ namespace BITKit
|
||||
public void Add(Action<float> action)=>GameTickService.Add(action);
|
||||
|
||||
public void Remove(Action<float> action)=>GameTickService.Remove(action);
|
||||
public void ManualTick(float delta)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
[CustomType(typeof(ITicker))]
|
||||
public class GameTickService : MonoBehaviour,ITicker
|
||||
@@ -48,6 +52,11 @@ namespace BITKit
|
||||
void ITicker.Add(Action action)=>Add(action);
|
||||
void ITicker.Add(Action<float> action)=>Add(action);
|
||||
void ITicker.Remove(Action<float> action)=>Remove(action);
|
||||
public void ManualTick(float delta)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
[SerializeField] private int tickRate = 32;
|
||||
[SerializeField] private bool isMainThread;
|
||||
[SerializeField] private bool isConcurrent;
|
||||
|
@@ -31,6 +31,11 @@ namespace BITKit
|
||||
{
|
||||
IntervalTickService.Remove(action, interval);
|
||||
}
|
||||
|
||||
public void ManualTick(float delta)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public class IntervalTickService
|
||||
|
10
Src/Unity/Scripts/Tick/MainTickService.cs
Normal file
10
Src/Unity/Scripts/Tick/MainTickService.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BITKit
|
||||
{
|
||||
|
||||
}
|
||||
|
11
Src/Unity/Scripts/Tick/MainTickService.cs.meta
Normal file
11
Src/Unity/Scripts/Tick/MainTickService.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1ce6e4128b8574947be2d54ac050e39c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
82
Src/Unity/Scripts/Tick/UnityTickService.cs
Normal file
82
Src/Unity/Scripts/Tick/UnityTickService.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Cysharp.Threading.Tasks.Triggers;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BITKit
|
||||
{
|
||||
|
||||
public class UnityUpdateTick:IMainTicker
|
||||
{
|
||||
public ulong TickCount { get; set; }
|
||||
public void Add(Action action)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Add(Action<float> action)=>UnityTickService.UpdateTick += action;
|
||||
|
||||
public void Remove(Action<float> action)=>UnityTickService.UpdateTick -= action;
|
||||
|
||||
public void ManualTick(float delta)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
public class UnityFixedUpdateTick:IFixedTicker
|
||||
{
|
||||
public ulong TickCount { get; set; }
|
||||
public void Add(Action action)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Add(Action<float> action)=>UnityTickService.FixedUpdateTick += action;
|
||||
|
||||
public void Remove(Action<float> action)=>UnityTickService.FixedUpdateTick -= action;
|
||||
|
||||
public void ManualTick(float delta)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
public class UnityLateUpdateTick:IAfterTicker
|
||||
{
|
||||
public ulong TickCount { get; set; }
|
||||
public void Add(Action action)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Add(Action<float> action)=>UnityTickService.LateUpdateTick += action;
|
||||
|
||||
public void Remove(Action<float> action)=>UnityTickService.LateUpdateTick -= action;
|
||||
|
||||
public void ManualTick(float delta)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
public class UnityTickService : MonoBehaviour
|
||||
{
|
||||
public static event Action<float> UpdateTick;
|
||||
public static event Action<float> FixedUpdateTick;
|
||||
public static event Action<float> LateUpdateTick;
|
||||
private void Update()
|
||||
{
|
||||
UpdateTick?.Invoke(Time.deltaTime);
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
FixedUpdateTick?.Invoke(Time.fixedDeltaTime);
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
LateUpdateTick?.Invoke(Time.deltaTime);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
11
Src/Unity/Scripts/Tick/UnityTickService.cs.meta
Normal file
11
Src/Unity/Scripts/Tick/UnityTickService.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 367ff25b1ec4724449ee78ab6690785b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user