Ejemplo n.º 1
0
    public void TestFixedGameStepGreaterThanFixedTime()
    {
        GameFixedUpdate gameFixedUpdate = new GameFixedUpdate();

        gameFixedUpdate.FixedStepTime = 0.05f;

        gameFixedUpdate.Init();

        gameFixedUpdate.Update(0.051f);

        Assert.That(gameFixedUpdate.CurrentGameFrame, Is.EqualTo(1));
    }
Ejemplo n.º 2
0
    public void TestFixedGameStepEngineCalled()
    {
        GameFixedUpdate    gameFixedUpdate = new GameFixedUpdate();
        GameStepEngineMock gameStepEngine  = new GameStepEngineMock();

        gameFixedUpdate.SetGameLogic(gameStepEngine);

        gameFixedUpdate.FixedStepTime = 0.05f;

        gameFixedUpdate.Init();

        gameFixedUpdate.Update(0.078f);

        Assert.That(gameStepEngine.lastDt, Is.EqualTo(0.05f));
        Assert.That(gameStepEngine.lastFrame, Is.EqualTo(0));
    }
Ejemplo n.º 3
0
    public void TestFixedGameStepTwoUpdates()
    {
        GameFixedUpdate gameFixedUpdate = new GameFixedUpdate();

        gameFixedUpdate.FixedStepTime = 0.05f;

        gameFixedUpdate.Init();

        gameFixedUpdate.Update(0.01f);

        Assert.That(gameFixedUpdate.CurrentGameFrame, Is.EqualTo(0));

        gameFixedUpdate.Update(0.045f);

        Assert.That(gameFixedUpdate.CurrentGameFrame, Is.EqualTo(1));
    }