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:
parent
36ba603933
commit
498f43f430
1 changed files with 7 additions and 7 deletions
|
@ -97,7 +97,7 @@ public class GameScreen implements Screen {
|
||||||
Unit enemy2 = new Unit();
|
Unit enemy2 = new Unit();
|
||||||
enemy2.name = "Bandit B";
|
enemy2.name = "Bandit B";
|
||||||
enemy2.positionX = 15;
|
enemy2.positionX = 15;
|
||||||
enemy2.positionY = 18;
|
enemy2.positionY = 30;
|
||||||
enemy2.team = Unit.Team.Enemy;
|
enemy2.team = Unit.Team.Enemy;
|
||||||
|
|
||||||
units.add(enemy2);
|
units.add(enemy2);
|
||||||
|
@ -150,12 +150,6 @@ public class GameScreen implements Screen {
|
||||||
void startNewTeamTurn(Unit.Team team) {
|
void startNewTeamTurn(Unit.Team team) {
|
||||||
currentTurnTeam = team;
|
currentTurnTeam = team;
|
||||||
|
|
||||||
for(Unit unit : units) {
|
|
||||||
if(unit.team == team) {
|
|
||||||
unit.hasTakenAction = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
currentUnitIndex = 0;
|
currentUnitIndex = 0;
|
||||||
getNextUnit();
|
getNextUnit();
|
||||||
|
|
||||||
|
@ -215,7 +209,13 @@ public class GameScreen implements Screen {
|
||||||
getNextUnit();
|
getNextUnit();
|
||||||
|
|
||||||
if(currentUnit == null) {
|
if(currentUnit == null) {
|
||||||
|
// reset everything
|
||||||
currentTurn++;
|
currentTurn++;
|
||||||
|
|
||||||
|
for(Unit unit : units) {
|
||||||
|
unit.hasTakenAction = false;
|
||||||
|
}
|
||||||
|
|
||||||
startNewTeamTurn(Unit.Team.Player);
|
startNewTeamTurn(Unit.Team.Player);
|
||||||
} else {
|
} else {
|
||||||
smoothlyTransitionCamera(new Vector3(currentUnit.positionX * 16, currentUnit.positionY * 16, 0));
|
smoothlyTransitionCamera(new Vector3(currentUnit.positionX * 16, currentUnit.positionY * 16, 0));
|
||||||
|
|
Reference in a new issue