Ejemplo n.º 1
0
    private void Update()
    {
        if (!SimulationScript.Instance.simulationInitialised)
        {
            return;
        }
        frameManager.UpdateFrameStartTime();
        int iterationsThisFrame = 0;

        if (frameManager.GetWantedIterationsPerSeccond() > 0)
        {
            int wantedIterationsThisFrame = frameManager.GetWantedIterationsThisFrame();
            if (wantedIterationsThisFrame > 0)
            {
                do
                {
                    frameManager.LogSimulationItterationStart();
                    UpdateSimulationWithoutDelay();
                    frameManager.LogSimulationItterationEnd();
                    iterationsThisFrame++;
                } while (iterationsThisFrame < wantedIterationsThisFrame && frameManager.CanStartNewIterationBeforeNextFrame());
            }
            frameManager.EndFrame(iterationsThisFrame);
        }
    }