fix: changed a couple of methods

This commit is contained in:
Laureηt 2021-04-13 21:24:36 +02:00
parent 696735af14
commit 6b74d3ad7c
3 changed files with 20 additions and 37 deletions

View file

@ -88,25 +88,16 @@ public class Bow extends Actor {
return new Arrow(angle, power, shooter);
}
/**
* Indiquer que c'est a son tour de jouer.
* Change the active state of the {@link Bow}.
* @param bool true or false
*/
public void startPlaying() {
playing = true;
public void setPlaying(boolean bool) {
playing = bool;
}
/**
* Indique que ce n'est plus son tour de jouer.
*/
public void stopPlaying() {
playing = false;
}
/**
* Savoir si il est entrain de jouer.
* @return the active state of the {@link Bow}.
*/
public boolean isPlaying() {
return playing;

View file

@ -75,23 +75,16 @@ public class Player extends BaseActor {
}
/**
* Indiquer que c'est son tour de jouer.
* Change the active state of the {@link Player}.
* @param bool true or false
*/
public void startPlaying() {
bow.startPlaying();
playing = true;
public void setPlaying(boolean bool) {
bow.setPlaying(bool);
playing = bool;
}
/**
* Indique la fin de son tour de jeu.
*/
public void stopPlaying() {
bow.stopPlaying();
playing = false;
}
/**
* Savoir si il est entrain de jouer.
* @return the active state of the {@link Player}.
*/
public boolean isPlaying() {
return playing;

View file

@ -54,7 +54,7 @@ public class GameScreen extends BaseScreen {
mainStage.addActor(players);
playerTurn = 0;
player1.startPlaying();
player1.setPlaying(true);
// arrows
arrows = new Group();
@ -81,16 +81,15 @@ public class GameScreen extends BaseScreen {
Player actualPlayer = (Player) players.getChild(playerTurn);
if (actualPlayer.isPlaying() && !actualPlayer.getBow().isPlaying()) {
actualPlayer.stopPlaying();
actualPlayer.setPlaying(true);
playerTurn++;
playerTurn %= players.getChildren().size;
actualPlayer = (Player) players.getChild(playerTurn);
actualPlayer.startPlaying();
actualPlayer.setPlaying(false);
}
}
public void removePlayer(Player player) {
int index = players.getChildren().indexOf(player, true);
if (index < playerTurn) {
@ -101,7 +100,7 @@ public class GameScreen extends BaseScreen {
players.removeActor(player);
playerTurn %= players.getChildren().size;
Player actualPlayer = (Player) players.getChild(playerTurn);
actualPlayer.startPlaying();
actualPlayer.setPlaying(true);
} else {
players.removeActor(player);
}