TimeUntil

A counterpart to TimeSince that keeps track of events we expect to occur in the future. Something like:

public struct TimeUntil
{
	TimeSince timeSince;

	public static implicit operator float(TimeUntil tu) => -tu.timeSince;

	public static implicit operator TimeUntil(float tu) => new TimeUntil { timeSince = -tu };
}

Then adding time to the clock in a short round-based game can be as simple as

timeUntilGameEnd += 30;

Might be useful for stuff that async functions wouldn’t handle as gracefully, for example, something that changes gradually as we approach a “deadline.” Hypothetically you could just use a TimeSince and add a negative sign every time, but it’s not quite as slick. Although, I admit it’s probably not big enough to include in the game. But other creators might find it useful, so I figured I would share. :^)

3 Likes

Sounds useful.

+1. Definitely would help users implement async easier.

This already exists :smile:

10 Likes

Don’t let the haters bring you down, this is going to work great!
Keep it up!

1 Like