diff --git a/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java b/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java index cebd5352c..64a323050 100644 --- a/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java +++ b/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java @@ -32,10 +32,7 @@ import com.csse3200.game.physics.PhysicsService; import com.csse3200.game.rendering.RenderService; import com.csse3200.game.rendering.Renderer; -import com.csse3200.game.services.CurrencyService; -import com.csse3200.game.services.GameTime; -import com.csse3200.game.services.ResourceService; -import com.csse3200.game.services.ServiceLocator; +import com.csse3200.game.services.*; import com.csse3200.game.ui.terminal.Terminal; import com.csse3200.game.ui.terminal.TerminalDisplay; import com.csse3200.game.components.maingame.MainGameExitDisplay; @@ -100,6 +97,7 @@ public MainGameScreen(GdxGame game) { ServiceLocator.registerEntityService(new EntityService()); ServiceLocator.registerRenderService(new RenderService()); + ServiceLocator.registerGameEndService(new GameEndService()); renderer = RenderFactory.createRenderer(); renderer.getCamera().getEntity().setPosition(CAMERA_POSITION); diff --git a/source/core/src/main/com/csse3200/game/services/GameEndService.java b/source/core/src/main/com/csse3200/game/services/GameEndService.java new file mode 100644 index 000000000..1790dc586 --- /dev/null +++ b/source/core/src/main/com/csse3200/game/services/GameEndService.java @@ -0,0 +1,22 @@ +package com.csse3200.game.services; + +public class GameEndService { + + private int engineerCount; + + public GameEndService() { + this.engineerCount = 5; + } + + public int getEngineerCount() { + return engineerCount; + } + + public void updateEngineerCount() { + engineerCount -= 1; + if (engineerCount == 0) { + // loss screen + + } + } +} diff --git a/source/core/src/main/com/csse3200/game/services/ServiceLocator.java b/source/core/src/main/com/csse3200/game/services/ServiceLocator.java index 5bbe956cc..5683715e4 100644 --- a/source/core/src/main/com/csse3200/game/services/ServiceLocator.java +++ b/source/core/src/main/com/csse3200/game/services/ServiceLocator.java @@ -24,6 +24,7 @@ public class ServiceLocator { private static GameTime timeSource; private static InputService inputService; private static ResourceService resourceService; + private static GameEndService gameEndService; public static CurrencyService getCurrencyService() { return currencyService; @@ -53,6 +54,10 @@ public static ResourceService getResourceService() { return resourceService; } + public static GameEndService getGameEndService() { + return gameEndService; + } + public static void registerCurrencyService(CurrencyService service) { logger.debug("Registering currency service {}", service); currencyService = service; @@ -88,6 +93,11 @@ public static void registerResourceService(ResourceService source) { resourceService = source; } + public static void registerGameEndService(GameEndService source) { + logger.debug("Registering game end service service {}", source); + gameEndService = source; + } + public static void clear() { entityService = null; renderService = null; @@ -95,6 +105,7 @@ public static void clear() { timeSource = null; inputService = null; resourceService = null; + gameEndService = null; } private ServiceLocator() {