Added separate EventManger for FixedUpdate.
This commit is contained in:
@@ -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();
|
||||
// }
|
||||
//}
|
||||
}
|
Reference in New Issue
Block a user