public void Update() { var world = new MockUniverse(); var universe = Universe.Builder.Build(world.Universe).Materialise(); var sol = universe.StarClusters .SelectMany(x => x.SolarSystems) .Single(x => x.Id == world.SolarSystem.ObjectId); var earth = sol.Satellites .Single(x => x.Id == world.Earth.ObjectId); var game = new Game(universe, u => Orbit(Satellites(u))); var ticksRemaining = game.Update(); ticksRemaining.ShouldBeGreaterThan(0); earth.Position.LocalCoordinates.ShouldNotBe(world.Earth.LocalCoordinates); }
private static void GameThread(Game game) { Stopwatch frameTimer = Stopwatch.StartNew(); while (_alive) { frameTimer.Start(); while (_commandQueue.Any()) { ICommand cmd = _commandQueue.Dequeue(); } game.Update(); long remaining = Game.TicksPerSlice - frameTimer.ElapsedTicks; if (remaining > 0) { Thread.Sleep(TimeSpan.FromTicks(remaining)); } frameTimer.Reset(); } }