public void TestNextLockstepFrameIsZeroIndexed() { // var gameLogic = NSubstitute.Substitute.For<DeterministicGameLogic> (); // var gameLogic = new TestGameStep.GameStepEngineMock (); var lockstepLogic = NSubstitute.Substitute.For <LockstepLogic> (); LockstepFixedUpdate lockstepGameLogic = new LockstepFixedUpdate(lockstepLogic); lockstepGameLogic.GameFramesPerLockstep = 4; lockstepGameLogic.FixedStepTime = 0.1f; // 0, 1, 2, 3 // 4, 5, 6, 7 // 8, 9, 10, 11 // lockstepGameLogic.SetGameLogic (gameLogic); // lockstepLogic.IsReady (0).Returns (true); Assert.That(lockstepGameLogic.GetFirstLockstepFrame(), Is.EqualTo(3)); Assert.That(lockstepGameLogic.GetNextLockstepFrame(0), Is.EqualTo(7)); Assert.That(lockstepGameLogic.GetNextLockstepFrame(1), Is.EqualTo(7)); Assert.That(lockstepGameLogic.GetNextLockstepFrame(2), Is.EqualTo(7)); Assert.That(lockstepGameLogic.GetNextLockstepFrame(4), Is.EqualTo(11)); Assert.That(lockstepGameLogic.GetNextLockstepFrame(5), Is.EqualTo(11)); Assert.That(lockstepGameLogic.GetNextLockstepFrame(6), Is.EqualTo(11)); // Assert.That (lockstepGameLogic.GetNextLockstepFrame (8), Is.EqualTo (16)); }
Command ConfigureCommand(Command command) { command.ProcessFrame = gameFixedUpdate.GetNextLockstepFrame(); return(command); }