Added Pause Functionality on pressing Menu button
import org.terasology.rendering.nui.layers.ingame.OnlinePlayersOverlay;
import org.terasology.rendering.opengl.ScreenGrabber;
import org.terasology.utilities.Assets;
+import org.terasology.engine.Time;
/**
* This system controls the client's in-game menus (Pause screen, Death screen, HUDs and overlays).
@In
private NUIManager nuiManager;
+ @In
+ private Time time;
+
+ //private boolean isPaused=false;
+ //private float currTimeDilation=time.getGameTimeDilation();
+
@Override
public void initialise() {
nuiManager.getHUD().addHUDElement("dropItemRegion"); //Ensure the drop region is behind the toolbar
@@ -58,6 +65,13 @@ public void onTogglePause(PauseButton event, EntityRef entity) {
nuiManager.toggleScreen("engine:pauseMenu");
event.consume();
}
+
+ if(!time.isPaused()){
+ time.setPaused(true);
+ }
+ else{
+ time.setPaused(false);
+ }
}
@ReceiveEvent(components = ClientComponent.class)
