diff --git a/source/core/assets/configs/Level1.json b/source/core/assets/configs/Level1.json deleted file mode 100644 index f07bdf623..000000000 --- a/source/core/assets/configs/Level1.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "1": [ - {"Xeno": 5} - ], - "2": [ - {"Xeno": 7} - ], - "3" : [ - {"Xeno": 4} - ] -} \ No newline at end of file diff --git a/source/core/src/main/com/csse3200/game/components/tasks/waves/LevelWaves.java b/source/core/src/main/com/csse3200/game/components/tasks/waves/LevelWaves.java index ba9cb8daf..a4a4aaabb 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/waves/LevelWaves.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/waves/LevelWaves.java @@ -61,6 +61,7 @@ public void spawnWave() { do { currentRandom = rand.nextInt(1, 7); } while (currentRandom == previousRandom); + ServiceLocator.getWaveService().setNextLane(currentRandom); GridPoint2 randomPos = new GridPoint2(19, currentRandom); this.getEvents().trigger("spawnWave", waves.get(waveIndex) .getMobs().get(mobIndex), randomPos); diff --git a/source/core/src/main/com/csse3200/game/components/tasks/waves/WaveTask.java b/source/core/src/main/com/csse3200/game/components/tasks/waves/WaveTask.java index b67f42edf..5ffcfdea9 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/waves/WaveTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/waves/WaveTask.java @@ -98,20 +98,24 @@ public void update() { // Check if level has been completed - no more waves remaining if (currentWaveIndex == this.level.getNumWaves()) { logger.info("No waves remaining, level completed"); - this.waveEnd.play(); ServiceLocator.getWaveService().setLevelCompleted(); } else { // Spawn the next wave logger.info("No enemies remaining, begin next wave"); + this.waveEnd.play(); this.waveInProgress = true; this.level.setWaveIndex(currentWaveIndex); + // Set the service wave count to the current wave index. + ServiceLocator.getWaveService().setWaveCount(currentWaveIndex); this.currentWave = this.level.getWave(currentWaveIndex); ServiceLocator.getWaveService().setEnemyCount(currentWave.getSize()); //endTime = globalTime.getTime() + (SPAWNING_INTERVAL * 1000L); // reset end time } } else { + logger.info("{} enemies remaining in wave {}", ServiceLocator.getWaveService().getEnemyCount(), currentWaveIndex); + logger.info("WAVE SERVICE NUMBER: Wave Number {}",ServiceLocator.getWaveService().getWaveCount()); if (waveInProgress) { this.level.spawnWave(); } diff --git a/source/core/src/main/com/csse3200/game/services/WaveService.java b/source/core/src/main/com/csse3200/game/services/WaveService.java index 3c2e05ebd..d09aa98d7 100644 --- a/source/core/src/main/com/csse3200/game/services/WaveService.java +++ b/source/core/src/main/com/csse3200/game/services/WaveService.java @@ -6,6 +6,11 @@ public class WaveService { private static final Logger logger = LoggerFactory.getLogger(WaveService.class); private int enemyCount; + private boolean gameOver = false; + private int lane; + + private int waveCount = 1; + private boolean levelCompleted = false; @@ -53,6 +58,14 @@ public void setLevelCompleted() { } } + public void setNextLane(int lane) { + this.lane = lane; + } + + public int getNextLane() { + return lane; + } + /** * Returns the game over state * @return (boolean) true if the game is over; false otherwise @@ -60,4 +73,12 @@ public void setLevelCompleted() { public boolean isLevelCompleted() { return levelCompleted; } + + public int getWaveCount() { + return this.waveCount; + } + + public void setWaveCount(int waveCount) { + this.waveCount += waveCount; + } }