From 5aa77d0418dee8c457a00f7130fbb65ab45c8ebd Mon Sep 17 00:00:00 2001 From: Nhat Minh Le Date: Tue, 17 Oct 2023 11:17:52 +1000 Subject: [PATCH] Fix the previous commit which failed tests + Remove some unneccessary comments --- .../tasks/bombship/BombshipCombatTask.java | 31 ------------------- .../tower/FireTowerAnimationController.java | 3 +- .../tower/StunTowerAnimationController.java | 4 +-- .../game/entities/factories/TowerFactory.java | 3 -- 4 files changed, 4 insertions(+), 37 deletions(-) diff --git a/source/core/src/main/com/csse3200/game/components/tasks/bombship/BombshipCombatTask.java b/source/core/src/main/com/csse3200/game/components/tasks/bombship/BombshipCombatTask.java index 860ed858d..3dd7a3124 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/bombship/BombshipCombatTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/bombship/BombshipCombatTask.java @@ -16,8 +16,6 @@ public class BombshipCombatTask extends DefaultTask implements PriorityTask { private static final int INTERVAL = 1; // The time interval for each target scan from the Engineer. private static final int PRIORITY = 3; // Default priority of the combat task when mobs are in range. - // private static final short TARGET1 = PhysicsLayer.BOSS; // The type of targets that the Engineer will detect. - // private static final short TARGET2 = PhysicsLayer.XENO; // Animation event names for the Engineer's state machine. private static final String START = "start"; @@ -30,12 +28,6 @@ public class BombshipCombatTask extends DefaultTask implements PriorityTask { private PhysicsEngine physics; private GameTime timeSource; private long endTime; -/* - private long reloadTime; - private ArrayList hits = new ArrayList<>(); - private final RaycastHit hit = new RaycastHit(); - private ArrayList targets = new ArrayList<>(); -*/ /** The Engineer's states. */ private enum STATE { @@ -128,28 +120,5 @@ public int getPriority() { public boolean isEngineerDied() { return true; } - - /** - * Fetches the nearest target from the array of detected target positions created during the last call of - * this could be done in the next sprint , the scan doesnt work as of now ! - * @return a Vector2 position of the nearest mob detected. - */ - /** public Vector2 fetchTarget() { - // Initial nearest position for comparison - int lowest = 10; - - Vector2 nearest = new Vector2(owner.getEntity().getCenterPosition().x, - owner.getEntity().getCenterPosition().y); - - // Find the nearest target from the array of targets - for (Vector2 tgt : targets){ - if (Math.abs(tgt.y - nearest.y) < lowest) { - lowest = (int)Math.abs(tgt.y - nearest.y); - nearest = tgt; - } - } - return nearest; - } - */ } diff --git a/source/core/src/main/com/csse3200/game/components/tower/FireTowerAnimationController.java b/source/core/src/main/com/csse3200/game/components/tower/FireTowerAnimationController.java index e6c692853..a2cd29c89 100644 --- a/source/core/src/main/com/csse3200/game/components/tower/FireTowerAnimationController.java +++ b/source/core/src/main/com/csse3200/game/components/tower/FireTowerAnimationController.java @@ -1,7 +1,9 @@ package com.csse3200.game.components.tower; +import com.badlogic.gdx.audio.Sound; import com.csse3200.game.components.Component; import com.csse3200.game.rendering.AnimationRenderComponent; +import com.csse3200.game.services.ServiceLocator; /** * Listens for events relevant to a weapon tower state. @@ -19,7 +21,6 @@ public class FireTowerAnimationController extends Component{ private static final String PREP_ATTACK_ANIM = "prepAttack"; private static final String ATTACK_ANIM = "attack"; private static final String DEATH_ANIM = "death"; - //here we can add the sounds for the implemented animations private static final String FIRE_SINGLE_SFX = "sounds/towers/Desert-Eagle-Far-Single-Gunshot.mp3"; diff --git a/source/core/src/main/com/csse3200/game/components/tower/StunTowerAnimationController.java b/source/core/src/main/com/csse3200/game/components/tower/StunTowerAnimationController.java index 1502e7f84..1fc59068a 100644 --- a/source/core/src/main/com/csse3200/game/components/tower/StunTowerAnimationController.java +++ b/source/core/src/main/com/csse3200/game/components/tower/StunTowerAnimationController.java @@ -1,7 +1,9 @@ package com.csse3200.game.components.tower; +import com.badlogic.gdx.audio.Sound; import com.csse3200.game.components.Component; import com.csse3200.game.rendering.AnimationRenderComponent; +import com.csse3200.game.services.ServiceLocator; /** * Listens to triggers phrases and executes the required animations. @@ -16,8 +18,6 @@ public class StunTowerAnimationController extends Component { private static final String ATTACK_ANIM = "attack"; private static final String DEATH_ANIM = "death"; - //further sounds can be added for the tower attacks/movement - private static final String FIRE_SINGLE_SFX = "sounds/towers/ar15_single_shot_far.mp3"; private final Sound fireSingleSound = ServiceLocator.getResourceService().getAsset( diff --git a/source/core/src/main/com/csse3200/game/entities/factories/TowerFactory.java b/source/core/src/main/com/csse3200/game/entities/factories/TowerFactory.java index a0dd250a7..dab77b83f 100644 --- a/source/core/src/main/com/csse3200/game/entities/factories/TowerFactory.java +++ b/source/core/src/main/com/csse3200/game/entities/factories/TowerFactory.java @@ -27,7 +27,6 @@ import java.util.HashSet; import java.util.Set; - /** * Factory to create a tower entity. * @@ -44,8 +43,6 @@ public class TowerFactory { private static final int TNT_TOWER_MAX_RANGE = 6; private static final int TNT_TOWER_RANGE = 6; private static final int TNT_KNOCK_BACK_FORCE = 10; - // private static final String WALL_IMAGE = "images/towers/wall_tower.png"; - // private static final String RESOURCE_TOWER = "images/towers/mine_tower.png"; private static final String TURRET_ATLAS = "images/towers/turret01.atlas"; private static final String FIRE_TOWER_ATLAS = "images/towers/fire_tower_atlas.atlas"; private static final String STUN_TOWER_ATLAS = "images/towers/stun_tower.atlas";