Skip to content

Commit

Permalink
Added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nawal-0 committed Oct 17, 2023
1 parent ed6ffaf commit 8eb5424
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
Expand All @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 8eb5424

Please sign in to comment.