1
Fork 0

Reset unit actions when a new turn begins

This fixes enemy units staying dark even on the next turn, which doesn't
make sense.
This commit is contained in:
Joshua Goins 2022-05-02 19:34:14 -04:00
parent 36ba603933
commit 498f43f430

View file

@ -97,7 +97,7 @@ public class GameScreen implements Screen {
Unit enemy2 = new Unit();
enemy2.name = "Bandit B";
enemy2.positionX = 15;
enemy2.positionY = 18;
enemy2.positionY = 30;
enemy2.team = Unit.Team.Enemy;
units.add(enemy2);
@ -150,12 +150,6 @@ public class GameScreen implements Screen {
void startNewTeamTurn(Unit.Team team) {
currentTurnTeam = team;
for(Unit unit : units) {
if(unit.team == team) {
unit.hasTakenAction = false;
}
}
currentUnitIndex = 0;
getNextUnit();
@ -215,7 +209,13 @@ public class GameScreen implements Screen {
getNextUnit();
if(currentUnit == null) {
// reset everything
currentTurn++;
for(Unit unit : units) {
unit.hasTakenAction = false;
}
startNewTeamTurn(Unit.Team.Player);
} else {
smoothlyTransitionCamera(new Vector3(currentUnit.positionX * 16, currentUnit.positionY * 16, 0));