Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/Team-4---Waves' into Team-4---Waves
Browse files Browse the repository at this point in the history
# Conflicts:
#	source/core/src/main/com/csse3200/game/components/tasks/waves/LevelWaves.java
  • Loading branch information
max9753 committed Sep 30, 2023
2 parents 60ff3da + 24e36dd commit 2b80bc8
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,22 @@ public float getSpawnDelay() {
public long getStartTime() {
return this.startTime;
}

/**
* Get the current mob index
* @return mob index
*/
public int getMobIndex() {
return this.mobIndex;
}

/**
* Get the current wave index
* @return wave index
*/
public int getWaveIndex() {
return this.waveIndex;
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public class WaveTask extends DefaultTask implements PriorityTask {
"sounds/waves/wave-end/Wave_Over_01.ogg"
};

private Sound waveStart;
private Sound waveEnd;
private final Sound waveStart;
private final Sound waveEnd;

/**
* Constructor for the WaveTask
Expand Down Expand Up @@ -71,7 +71,7 @@ public int getPriority() {

/**
* Starts the WaveTask and initialises all relevant attributes.
* Sets the current count of enmies to be the size of the current wave.
* Sets the current count of enemies to be the size of the current wave.
*/
@Override
public void start() {
Expand Down Expand Up @@ -129,4 +129,12 @@ public void update() {
}
}
}
}

/**
* Checks if the current wave is in progress
* @return true if the wave is in progress, false otherwise
*/
public boolean isWaveInProgress() {
return waveInProgress;
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,38 @@
package com.csse3200.game.components.tasks.waves;

import com.csse3200.game.areas.ForestGameArea;
import com.csse3200.game.entities.factories.WaveFactory;
import com.csse3200.game.extensions.GameExtension;
import com.csse3200.game.services.GameTime;
import com.csse3200.game.services.ServiceLocator;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.junit.jupiter.MockitoExtension;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

@ExtendWith(GameExtension.class)
@ExtendWith(MockitoExtension.class)
class LevelWavesTest {

LevelWaves levelWaves;
WaveClass wave;
ServiceLocator serviceLocator;

@BeforeEach
void setUp() {
levelWaves = (LevelWaves) WaveFactory.createWaves();
wave = mock(WaveClass.class);
}

@Test
public void testAddWave() {
levelWaves.addWave(wave);
assertEquals(3, levelWaves.waves.size());
}

@Test
public void testSpawnWaveStart() {

}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.csse3200.game.components.tasks.waves;

import com.badlogic.gdx.audio.Sound;
import com.csse3200.game.areas.ForestGameArea;
import com.csse3200.game.areas.terrain.TerrainFactory;
import com.csse3200.game.components.tasks.DroidCombatTask;
import com.csse3200.game.extensions.GameExtension;
import com.csse3200.game.services.GameTime;
Expand All @@ -14,6 +16,7 @@
import java.util.logging.Level;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

Expand All @@ -24,6 +27,7 @@ class WaveTaskTest {
WaveTask waveTask;
ResourceService resourceService;
LevelWaves level;
ForestGameArea gameArea;
@BeforeEach
void setUp() {
resourceService = ServiceLocator.getResourceService();
Expand All @@ -48,9 +52,9 @@ public void testGetPriority() {

@Test
public void testStartWave() {
WaveTask waveTask = new WaveTask();
waveTask.start();
assertEquals(1, waveTask.getPriority());
assertTrue(waveTask.isWaveInProgress());
}

}

0 comments on commit 2b80bc8

Please sign in to comment.