ソースを参照

feat: give GameState a reference to GameActor

Can use this on AI turns etc to send messages back to frontend
rdh-local-prototype-endturn
Rob Hallam 9ヶ月前
コミット
bef929df9f
2個のファイルの変更12行の追加0行の削除
  1. +2
    -0
      app/actors/GameActor.java
  2. +10
    -0
      app/structures/GameState.java

+ 2
- 0
app/actors/GameActor.java ファイルの表示

@@ -64,6 +64,8 @@ public class GameActor extends AbstractActor {
// Initalize a new game state object
gameState = new GameState();
// #hack: give the game state a reference to the game actor so AIPlayer can send messages
gameState.gameActor = this;
// Get the list of image files to pre-load the UI with
Set<String> images = ImageListForPreLoad.getImageListForPreLoad();


+ 10
- 0
app/structures/GameState.java ファイルの表示

@@ -1,5 +1,8 @@
package structures;
import actors.GameActor;
import structures.basic.AIPlayer;
/**
* This class can be used to hold information about the on-going game.
* Its created with the GameActor.
@@ -13,5 +16,12 @@ public class GameState {
public boolean gameInitalised = false;
public boolean something = false;
public int currentPlayer = 1;
public AIPlayer aiPlayer = new AIPlayer();
// bit of a hack but include a reference to the GameActor so AIPlayer can send messages to it
public GameActor gameActor;
}

読み込み中…
キャンセル
保存