Skip to content

Commit

Permalink
Merge pull request #6 from ryanslikesocool/2.3.0
Browse files Browse the repository at this point in the history
2.3.0
  • Loading branch information
ryanslikesocool authored Nov 13, 2023
2 parents 689400e + 02db8a9 commit 58791a6
Show file tree
Hide file tree
Showing 26 changed files with 1,515 additions and 976 deletions.
Binary file removed .DS_Store
Binary file not shown.
922 changes: 561 additions & 361 deletions Scripts/CKClock.cs

Large diffs are not rendered by default.

63 changes: 33 additions & 30 deletions Scripts/CKClockController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,47 @@
using UnityEngine;

namespace ClockKit {
internal sealed class CKClockController : AutoSingleton<CKClockController> {
// MARK: - Properties
internal sealed class CKClockController : AutoSingleton<CKClockController> {
// MARK: - Properties

internal Dictionary<CKQueue, CKUpdateQueue> queues = default;
internal Dictionary<CKQueue, CKUpdateQueue> queues = default;

// MARK: - Lifecycle
// MARK: - Lifecycle

protected override void Awake() {
base.Awake();
protected override void Awake() {
base.Awake();

float time = Time.time;
queues = new Dictionary<CKQueue, CKUpdateQueue> {
{ CKQueue.Update, new CKUpdateQueue(CKQueue.Update, time) },
{ CKQueue.FixedUpdate, new CKUpdateQueue(CKQueue.FixedUpdate, time) },
{ CKQueue.LateUpdate, new CKUpdateQueue(CKQueue.LateUpdate, time) },
};
float time = Time.time;
queues = new Dictionary<CKQueue, CKUpdateQueue> {
{ CKQueue.Update, new CKUpdateQueue(CKQueue.Update, time) },
{ CKQueue.FixedUpdate, new CKUpdateQueue(CKQueue.FixedUpdate, time) },
{ CKQueue.LateUpdate, new CKUpdateQueue(CKQueue.LateUpdate, time) },
};

gameObject.hideFlags = HideFlags.HideAndDontSave;
DontDestroyOnLoad(gameObject);
}
gameObject.hideFlags = HideFlags.HideAndDontSave;
DontDestroyOnLoad(gameObject);
}

protected override void OnApplicationQuit() {
base.OnApplicationQuit();
Destroy(gameObject);
}
protected override void OnApplicationQuit() {
CKClock.RemoveAllDelegates();
CKClock.StopAllTimers();

// MARK: - Update
base.OnApplicationQuit();
Destroy(gameObject);
}

private void Update() {
queues[CKQueue.Update].Update(Time.time);
}
// MARK: - Update

private void FixedUpdate() {
queues[CKQueue.FixedUpdate].Update(Time.time);
}
private void Update() {
queues[CKQueue.Update].Update(Time.time);
}

private void LateUpdate() {
queues[CKQueue.LateUpdate].Update(Time.time);
}
}
private void FixedUpdate() {
queues[CKQueue.FixedUpdate].Update(Time.time);
}

private void LateUpdate() {
queues[CKQueue.LateUpdate].Update(Time.time);
}
}
}
Loading

0 comments on commit 58791a6

Please sign in to comment.