diff --git a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuTimeStopComponent.java b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuTimeStopComponent.java index 7871fbe94..285fad8e2 100644 --- a/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuTimeStopComponent.java +++ b/source/core/src/main/com/csse3200/game/components/pausemenu/PauseMenuTimeStopComponent.java @@ -1,22 +1,40 @@ package com.csse3200.game.components.pausemenu; import com.csse3200.game.components.Component; +import com.csse3200.game.entities.Entity; +import com.badlogic.gdx.utils.Array; import com.csse3200.game.services.ServiceLocator; /** * Handles the pausing/resuming of time when the pause menu is brought up/put away. */ public class PauseMenuTimeStopComponent extends Component { + + private Array freezeList; public PauseMenuTimeStopComponent() { } + /** + * Handles the pausing of the game entities when the pause menu is made. + */ @Override public void create() { - ServiceLocator.getTimeSource().setTimeScale(0f); + freezeList = ServiceLocator.getEntityService().getEntities(); + for (Entity pauseTarget : freezeList) { + if (pauseTarget.getId() != getEntity().getId()) { + // ZA WARUDO! TOKI WO TOMARE! + pauseTarget.setEnabled(false); + } + } } + /** + * Handles the un-pausing of the game entities when the pause menu is closed. + */ @Override public void dispose() { - ServiceLocator.getTimeSource().setTimeScale(1f); + for (Entity pauseTarget : freezeList) { + pauseTarget.setEnabled(true); + } } }