using System.Diagnostics;
public int Day { get; set; }
public int Month { get; set; }
public int Year { get; set; }
public int Ticks { get; private set; }
public GameTime Time { get; private set; }
public void IncrementTick(long frameTime)
public interface ITickContext
GameTime CurrentTime { get; }
public class TickContext : ITickContext
private long _previousFrameTime;
public GameTime CurrentTime => _clock.Time;
public TickContext(Clock clock)
public void ProgressToNextTick(long frameTime)
_previousFrameTime = frameTime;
_clock.IncrementTick(frameTime);
public interface ITickable
void Tick(ITickContext ctx);
public class WeatherSystem : ITickable
public void Tick(ITickContext context)
public static class Program
public static void Main()
var tickables = new ITickable[] { new WeatherSystem() };
var stopwatch = new Stopwatch();
var context = new TickContext(clock);
foreach (var tickable in tickables)
var duration = stopwatch.ElapsedMilliseconds;
context.ProgressToNextTick(duration);