From 8eb54242df840246a495be3b672b581785b7dfa7 Mon Sep 17 00:00:00 2001 From: Nawal Date: Tue, 17 Oct 2023 11:21:40 +1000 Subject: [PATCH] Added comments --- .../game/input/EngineerInputComponent.java | 19 +++++++++++++++++++ .../game/services/GameEndService.java | 7 +++++++ 2 files changed, 26 insertions(+) diff --git a/source/core/src/main/com/csse3200/game/input/EngineerInputComponent.java b/source/core/src/main/com/csse3200/game/input/EngineerInputComponent.java index f938dc79c..75a37bb07 100644 --- a/source/core/src/main/com/csse3200/game/input/EngineerInputComponent.java +++ b/source/core/src/main/com/csse3200/game/input/EngineerInputComponent.java @@ -77,6 +77,12 @@ private void manualShoot() { wander.startCombat(); } + /** + * Switches the specified engineer + * If the given engineer is already selected, deselect it + * If another engineer is selected, deselect it and select the new given engineer + * @param engineer (Entity) the specified engineer + */ private void switchEngineer(Entity engineer) { if (engineer.equals(this.selectedEngineer)) { this.getWanderTask().setSelected(false); @@ -98,6 +104,11 @@ else if (selectedEngineer == null) { } } + /** + * Switches the outline of the given engineer and deselects/selects engineer as needed + * If outlined -> remove outline, deselect engineer and vice versa + * @param engineer (Entity) the specified engineer + */ private void switchOutline(Entity engineer) { AnimationRenderComponent animator = engineer.getComponent(AnimationRenderComponent.class); String currentAnimation = animator.getCurrentAnimation(); @@ -111,11 +122,19 @@ private void switchOutline(Entity engineer) { } } + /** + * Returns the wander task of the selected engineer + * @return (HumanWanderTask) the wander task of the selected engineer + */ private HumanWanderTask getWanderTask() { AITaskComponent movementTask = selectedEngineer.getComponent(AITaskComponent.class); return movementTask.getTask(HumanWanderTask.class); } + /** + * Moves the selected engineer to the given cursor position + * @param cursorPosition (Vector2) the cursor position + */ public void moveEngineer(Vector2 cursorPosition) { if (selectedEngineer == null) { logger.info("Trying to move an engineer that is not selected"); diff --git a/source/core/src/main/com/csse3200/game/services/GameEndService.java b/source/core/src/main/com/csse3200/game/services/GameEndService.java index 2ac4bddbb..ee576a974 100644 --- a/source/core/src/main/com/csse3200/game/services/GameEndService.java +++ b/source/core/src/main/com/csse3200/game/services/GameEndService.java @@ -68,10 +68,17 @@ public EngineerCountDisplay getDisplay() { return display; } + /** + * Returns the number of spawned engineers + * @return (int) number of spawned engineers + */ public int getNumSpawnedEngineers() { return numSpawnedEngineers; } + /** + * Increments the number of spawned engineers + */ public void incrementNumSpawnedEngineers(){ numSpawnedEngineers += 1; }