From d63461b58f30035483e55a151026ed9c52ca462d Mon Sep 17 00:00:00 2001 From: Mohamad Date: Tue, 17 Oct 2023 10:31:41 +1000 Subject: [PATCH 1/2] Added Shake screen effect at every wave --- .../game/components/maingame/UIElementsDisplay.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/core/src/main/com/csse3200/game/components/maingame/UIElementsDisplay.java b/source/core/src/main/com/csse3200/game/components/maingame/UIElementsDisplay.java index ecf3c9758..b18130489 100644 --- a/source/core/src/main/com/csse3200/game/components/maingame/UIElementsDisplay.java +++ b/source/core/src/main/com/csse3200/game/components/maingame/UIElementsDisplay.java @@ -21,6 +21,7 @@ public class UIElementsDisplay extends UIComponent { private final Table buttonTable = new Table(); private TextButton remainingMobsButton; private TextButton timerButton; + long time = 0; @Override public void create() { @@ -98,7 +99,14 @@ public void updateTimerButton() { createTimerButton(); } timerButton.setText("Next wave in: " + finalTime); + time = ServiceLocator.getTimeSource().getTime(); } else { + if (ServiceLocator.getTimeSource().getTime() < time + 2000) { + ServiceLocator.getMapService().shakeCameraMap(); + ServiceLocator.getMapService().shakeCameraGrid(); + } +// ServiceLocator.getMapService().shakeCameraMap(); +// ServiceLocator.getMapService().shakeCameraGrid(); remainingMobsButton.setDisabled(true); timerButton.addAction(new SequenceAction(Actions.fadeOut(1f), Actions.removeActor())); stage.act(); From f4d737287853b23ab301e7d2741fe35a9b3344a9 Mon Sep 17 00:00:00 2001 From: Mohamad Date: Tue, 17 Oct 2023 10:35:26 +1000 Subject: [PATCH 2/2] fixed code smells --- .../csse3200/game/components/maingame/UIElementsDisplay.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/source/core/src/main/com/csse3200/game/components/maingame/UIElementsDisplay.java b/source/core/src/main/com/csse3200/game/components/maingame/UIElementsDisplay.java index b18130489..c3e9d24ff 100644 --- a/source/core/src/main/com/csse3200/game/components/maingame/UIElementsDisplay.java +++ b/source/core/src/main/com/csse3200/game/components/maingame/UIElementsDisplay.java @@ -21,7 +21,7 @@ public class UIElementsDisplay extends UIComponent { private final Table buttonTable = new Table(); private TextButton remainingMobsButton; private TextButton timerButton; - long time = 0; + private long time = 0; @Override public void create() { @@ -105,8 +105,6 @@ public void updateTimerButton() { ServiceLocator.getMapService().shakeCameraMap(); ServiceLocator.getMapService().shakeCameraGrid(); } -// ServiceLocator.getMapService().shakeCameraMap(); -// ServiceLocator.getMapService().shakeCameraGrid(); remainingMobsButton.setDisabled(true); timerButton.addAction(new SequenceAction(Actions.fadeOut(1f), Actions.removeActor())); stage.act();