Added separate EventManger for FixedUpdate.

This commit is contained in:
2024-04-23 14:03:38 +02:00
parent 6b0bb3de6b
commit 1ca24af85a
11 changed files with 85 additions and 37 deletions

View File

@@ -2,35 +2,27 @@ using UnityEngine;
namespace Utils
{
/// <summary>
/// https://garry.tv/timesince
/// </summary>
/// <example>
/// Do something after 10 seconds.
/// <code>
/// TimeSince ts;
/// void Start() => ts = 0;
/// void Update()
/// {
/// if (ts > 10)
/// Something();
/// }
/// </code>
/// </example>
public struct TimeSince
{
private float time;
public static implicit operator float(TimeSince ts)
{
return Time.time - ts.time;
}
public static implicit operator float(TimeSince ts) => Time.time - ts.time;
public static implicit operator TimeSince(float ts)
{
return new TimeSince { time = Time.time - ts };
}
public static implicit operator TimeSince(float ts) => new() { time = Time.time - ts };
}
}
// https://garry.tv/timesince
//TimeSince ts;
//void Start()
//{
// ts = 0;
//}
//void Update()
//{
// if (ts > 10)
// {
// DoSomethingAfterTenSeconds();
// }
//}
}