Skip to content

Commit

Permalink
Merge branch 'main' into Team-1-Mobs-Enhancement-variations
Browse files Browse the repository at this point in the history
  • Loading branch information
MiniSoda17 committed Oct 17, 2023
2 parents 73be9d2 + 809a9de commit d1edd54
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ public class ForestGameArea extends GameArea {
private static final Logger logger = LoggerFactory.getLogger(ForestGameArea.class);

private Timer waveTimer;

private static final int NUM_WEAPON_TOWERS = 3;
private static final GridPoint2 PLAYER_SPAWN = new GridPoint2(2, 4);
// Temporary spawn point for testing
private static final float WALL_WIDTH = 0.1f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,22 +132,6 @@ public int getPriority() {
return !isTargetVisible() ? 0 : priority;
}

/**
* not currently used.
* @return the priority for this task
*/
public int getActivePriority() {
return !isTargetVisible() ? 0 : priority;
}

/**
* not currently used.
* @return
*/
public int getInactivePriority() {
return isTargetVisible() ? priority : 0;
}

/**
* detects targets from the centre of the tower to maxRange in a straight line.
* @return true if mobs are present and false otherwise.
Expand All @@ -160,15 +144,6 @@ private void changeFireRateInterval(int newInterval) {
fireRateInterval = 1 / ((float) newInterval / 5);
}

/**
* Function for getting the turret's fire rate.
*
* @return The fireRateInterval variable
*/
public float getFireRateInterval() {
return fireRateInterval;
}

/**
* Function for getting the tower's state.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,6 @@ public int getPriority() {
return !isTargetVisible() ? 0 : priority;
}

public int getActivePriority() {
return !isTargetVisible() ? 0 : priority;
}

public int getInactivePriority() {
return isTargetVisible() ? priority : 0;
}

/**
* Searches for enemies/mobs in a straight line from the centre of the tower to maxRange in a straight line.
* @return true if targets are detected, false otherwise
Expand All @@ -195,12 +187,4 @@ private void changeFireRateInterval(int newInterval) {
fireRateInterval = 1 / ((float) newInterval / 5);
}

/**
* Function for getting the turret's fire rate.
*
* @return The fireRateInterval variable
*/
public float getFireRateInterval() {
return fireRateInterval;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@
* the properties stores in 'BaseTowerConfigs'.
*/
public class TowerFactory {
private static final Logger logger = LoggerFactory.getLogger(TowerFactory.class);

// Define a set to keep track of occupied lanes
private static final Set<Integer> occupiedLanes = new HashSet<>();
private static final int COMBAT_TASK_PRIORITY = 2;
private static final int WEAPON_TOWER_MAX_RANGE = 40;
private static final int TNT_TOWER_MAX_RANGE = 6;
Expand Down Expand Up @@ -466,28 +462,4 @@ public static Entity createBaseTower() {
tower.getComponent(ColliderComponent.class).setAsBoxAligned(new Vector2(1f, 1f), PhysicsComponent.AlignX.CENTER, PhysicsComponent.AlignY.CENTER);
return tower;
}

public static Entity createAndPlaceTower(int lane) {
if (isLaneOccupied(lane)) {
logger.info(String.format("Lane %d is already occupied by a tower", lane));
return null;
}

Entity tower = createBaseTower();
// Customize the tower creation here based on the chosen tower type

// Add the lane to the set of occupied lanes
occupiedLanes.add(lane);

return tower;
}

/**
* Checks if a lane is already occupied by a tower.
* @param lane The lane to check.
* @return True if the lane is occupied, false otherwise.
*/
public static boolean isLaneOccupied(int lane) {
return occupiedLanes.contains(lane);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,11 @@ public void render(float delta) {
ServiceLocator.getWaveService().getDisplay().updateMobCount();
renderer.render();

// Check if the game has ended
// Check if the game has ended
if (ServiceLocator.getGameEndService().hasGameEnded()) {
ui.getEvents().trigger("lose");
}

// Check if all waves are completed and the level has been completed
if (ServiceLocator.getWaveService().isLevelCompleted()) {
} else if (ServiceLocator.getWaveService().isLevelCompleted()) {
// Check if all waves are completed and the level has been completed
if (selectedLevel == 2) { // Lava level
// If it's the lava level, go to the "win" screen
ui.getEvents().trigger("win");
Expand All @@ -232,7 +229,6 @@ public void render(float delta) {
}
}
}
// Add something in to unlock the next planet/level?

@Override
public void resize(int width, int height) {
Expand Down

0 comments on commit d1edd54

Please sign in to comment.