Skip to content

Commit

Permalink
more tidying
Browse files Browse the repository at this point in the history
  • Loading branch information
The-AhmadAA committed Oct 16, 2023
1 parent a4b89dd commit 2fb70da
Showing 1 changed file with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,13 @@
import com.csse3200.game.screens.TowerType;
import com.csse3200.game.services.CurrencyService;
import com.csse3200.game.services.ServiceLocator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
* Input component for handling in-game tower building. Based on Team 5 implementation of
* DropInputComponent
*/
public class BuildInputComponent extends InputComponent {
private static final Logger logger = LoggerFactory.getLogger(BuildInputComponent.class);
private final EntityService entityService;
private final Camera camera;
private final String[] sounds = {
Expand Down Expand Up @@ -108,30 +105,35 @@ public boolean touchDown(int screenX, int screenY, int pointer, int button) {
@Override
public boolean keyUp(int keycode) {
switch (keycode) {
case Input.Keys.NUM_1:
case Input.Keys.NUM_1 -> {
ServiceLocator.getCurrencyService().setTowerType(towers.get(0));
return true;
case Input.Keys.NUM_2:
}
case Input.Keys.NUM_2 -> {
ServiceLocator.getCurrencyService().setTowerType(towers.get(1));
return true;
case Input.Keys.NUM_3:
}
case Input.Keys.NUM_3 -> {
ServiceLocator.getCurrencyService().setTowerType(towers.get(2));
return true;
case Input.Keys.NUM_4:
}
case Input.Keys.NUM_4 -> {
ServiceLocator.getCurrencyService().setTowerType(towers.get(3));
return true;
case Input.Keys.NUM_5:
}
case Input.Keys.NUM_5 -> {
ServiceLocator.getCurrencyService().setTowerType(towers.get(4));
return true;
case Input.Keys.CONTROL_LEFT:
}
case Input.Keys.CONTROL_LEFT -> {
// After multiple placement, deselect tower and prevent further builds
ServiceLocator.getCurrencyService().setTowerType(null);
multipleTowerBuild = false;
return true;
case Input.Keys.ESCAPE:

default:
}
default -> {
return false;
}
}
}

Expand Down

0 comments on commit 2fb70da

Please sign in to comment.