refactor endRound

This commit is contained in:
Antoine 2021-06-24 01:27:41 +02:00
parent 20788b59c7
commit e2ac89a375

View File

@ -28,6 +28,7 @@ import gameplay.input.ButtonIG;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.sql.SQLOutput;
import java.util.ArrayList;
import java.util.List;
@ -129,20 +130,19 @@ public class match {
/**
* Ends the round.
* Used for playing animations and such.
* TODO : Implement this once we know what to do.
* @throws InterruptedException
*/
private static void endRound() throws InterruptedException {
private static void endRound() {
String victoryTxt = roundP1 ? "Player1 won the round" : "Player2 won the round";
if(roundP1) {
//texte de victoire
System.out.println("P1 won the round");
roundWon = new UIElementText("Player1 won the round", 5f, 0.25f, 0.5f, 100f, engine);
roundWon.setBackground(new Vector3f(0f,0f,0f));
System.out.println(victoryTxt);
roundWon = new UIElementText(victoryTxt, 5f, 0.25f, 0.5f, 100f, engine);
engine.add_uiElement(roundWon);
engine.update();
engine.render();
Thread.sleep(1000);
glfwWaitEventsTimeout(1);
engine.remove_uiElement(roundWon);
//replacement des sprites
@ -150,24 +150,7 @@ public class match {
objP2.translate(new Vector3f(-p2.getPosX(), -p2.getPosY()));
objP1.getShadow().translate(new Vector3f(0f,-p1.getPosY(),0));
objP2.getShadow().translate(new Vector3f(0f,-p2.getPosY(),0));
}
else {
//texte de victoire
System.out.println("P2 won the round");
roundWon = new UIElementText("Player2 won the round", 5f, 0.25f, 0.5f, 100f, engine);
roundWon.setBackground(new Vector3f(0f,0f,0f));
engine.add_uiElement(roundWon);
engine.update();
engine.render();
Thread.sleep(1000);
engine.remove_uiElement(roundWon);
//replacement des sprites
objP1.translate(new Vector3f(-p1.getPosX(), -p1.getPosY()));
objP2.translate(new Vector3f(-p2.getPosX(), -p2.getPosY()));
objP1.getShadow().translate(new Vector3f(0f,-p1.getPosY(),0));
objP2.getShadow().translate(new Vector3f(0f,-p2.getPosY(),0));
}
}
/**