Skip to content

Commit

Permalink
Adds functionality to support multiple waves in a level
Browse files Browse the repository at this point in the history
  • Loading branch information
bojyyy committed Sep 27, 2023
1 parent 477e2fc commit ea67bfe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public void update() {
logger.info("No enemies remaining, begin next wave");
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ public class WaveFactory {
*/
public static Entity createWaves() {
HashMap<String, Integer> mobs = new HashMap<>();
mobs.put("Xeno", 5);
WaveClass wave = new WaveClass(mobs);
mobs.put("Xeno", 0);
HashMap<String, Integer> mobs2 = new HashMap<>();
mobs2.put("Xeno", 3);
WaveClass wave1 = new WaveClass(mobs);
WaveClass wave2 = new WaveClass(mobs2);
LevelWaves level = new LevelWaves(1);
level.addWave(wave);
level.addWave(wave1);
level.addWave(wave2);
AITaskComponent aiComponent =
new AITaskComponent()
.addTask(new WaveTask());
Expand Down

0 comments on commit ea67bfe

Please sign in to comment.