Sfoglia il codice sorgente

feat: add setupGameState method for initialising game state

This will be called from the Initialise class, making the game state ready to be
played- create player instances, board, tiles, cards etc
rdh-local-prototype-endturn
Rob Hallam 9 mesi fa
parent
commit
87ed62cc7a
1 ha cambiato i file con 25 aggiunte e 7 eliminazioni
  1. +25
    -7
      app/structures/GameState.java

+ 25
- 7
app/structures/GameState.java Vedi File

@@ -11,17 +11,35 @@ import structures.basic.AIPlayer;
*
*/
public class GameState {
public boolean gameInitalised = false;
public boolean something = false;
public int currentPlayer = 1;
public AIPlayer aiPlayer = new AIPlayer();
private GameActor gameActor;
// note: still a bit of a hack but we remove this from GameState
// and give it to the AIPlayer on initialisation, and it can then
// be removed from here
public AIPlayer aiPlayer;
public GameState() {
super();
}
public void setGameActor(GameActor gameActor) {
this.gameActor = gameActor;
}
// bit of a hack but include a reference to the GameActor so AIPlayer can send messages to it
public GameActor gameActor;
/** Set up everything the game needs to be played (called via initialise game event)
*
*/
public void setupGameState() {
// do game setup
this.gameInitalised = true;
// set initial player
this.currentPlayer = 1;
// create the AI player:
this.aiPlayer = new AIPlayer(this.gameActor);
}
}

Caricamento…
Annulla
Salva