You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.5 KiB

class Equipe {
int id, score, tour;
float radius;
float posX, posY;
Pion pion;
Equipe(int id) {
this.id = id;
this.score = 0;
this.tour = 0;
// générer un pion pour l'équipe
this.pion = new Pion(this.id);
// récupérer les valeurs de positionnement initial du pion
this.posX = this.pion.posX;
this.posY = this.pion.posY;
this.radius = this.pion.radius;
// afficher l'emplacement de l'équipe
this.update();
}
void update() {
// affichage de l'emplacement d'équipe, qui restera toujours fixe
color bgColor = color(235, 112, 71, 0.8);
color textColor = color(200);
fill(bgColor);
stroke(bgColor);
strokeWeight(0.5);
circle(this.posX,this.posY,radius);
fill(textColor);
float textSize = this.radius/4*3;
textSize(textSize);
float pos_x = this.id<9? this.posX-radius/5: this.posX-radius/3;
text(this.id+1, pos_x, this.posY+radius/5);
// mise à jour du pion
this.pion.draw();
}
void setScore(int score) {
if (this.score==score) return;
int oldScore = this.score;
this.incTour();
println("Equipe", this.id+1, "setScore from", oldScore, "to", score, "turn updated to", this.tour);
this.score = score;
this.update();
Scoreboard.applyScore(this.id, this.score, this.tour);
drawAround(oldScore);
drawAround(this.score);
}
void incTour() {
this.tour++;
}
void setTour(int tour) {
this.tour = tour;
}
}