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);
}
}
Aggregations