Search in sources :

Example 1 with GameEngine

use of org.terasology.engine.GameEngine in project Terasology by MovingBlocks.

the class StateLoading method update.

@Override
public void update(float delta) {
    GameEngine gameEngine = context.get(GameEngine.class);
    EngineTime time = (EngineTime) context.get(Time.class);
    long startTime = time.getRealTimeInMs();
    while (current != null && time.getRealTimeInMs() - startTime < 20 && !gameEngine.hasPendingState()) {
        if (current.step()) {
            popStep();
        }
    }
    if (current == null) {
        nuiManager.closeScreen(loadingScreen);
        nuiManager.setHUDVisible(true);
        context.get(GameEngine.class).changeState(new StateIngame(gameManifest, context));
    } else {
        float progressValue = (progress + current.getExpectedCost() * current.getProgress()) / maxProgress;
        loadingScreen.updateStatus(current.getMessage(), progressValue);
        nuiManager.update(delta);
    }
}
Also used : EngineTime(org.terasology.engine.EngineTime) GameEngine(org.terasology.engine.GameEngine) Time(org.terasology.engine.Time) EngineTime(org.terasology.engine.EngineTime)

Aggregations

EngineTime (org.terasology.engine.EngineTime)1 GameEngine (org.terasology.engine.GameEngine)1 Time (org.terasology.engine.Time)1