mirror of
https://github.com/guezoloic/L3-racing-game.git
synced 2026-03-30 11:56:14 +00:00
feat: correction plupart des bug
- TODO: hybridCar a regler
This commit is contained in:
@@ -69,24 +69,18 @@ public class Game {
|
||||
}
|
||||
|
||||
public Game build() {
|
||||
Game game = new Game();
|
||||
Game game = new Game(this.map, this.time, this.OBSERVERS);
|
||||
|
||||
for (Game.Observer observer : this.OBSERVERS) {
|
||||
for (Game.Observer observer : new ArrayList<>(this.OBSERVERS)) {
|
||||
switch (observer) {
|
||||
case GameView gameView -> {
|
||||
gameView.setGame(game);
|
||||
}
|
||||
case Car car -> {
|
||||
car.setMap(map);
|
||||
}
|
||||
default -> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
game.map = this.map;
|
||||
game.time = this.time;
|
||||
game.observers = this.OBSERVERS;
|
||||
return game;
|
||||
}
|
||||
}
|
||||
@@ -104,6 +98,16 @@ public class Game {
|
||||
this.map = map;
|
||||
this.time = time;
|
||||
this.observers = observer;
|
||||
|
||||
for (Game.Observer obs : this.observers) {
|
||||
switch (obs) {
|
||||
case Car car -> {
|
||||
car.setMap(map);
|
||||
}
|
||||
default -> {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Game addObserver(Observer o) {
|
||||
@@ -153,6 +157,7 @@ public class Game {
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public synchronized boolean togglePause() {
|
||||
|
||||
Reference in New Issue
Block a user