|
|
@@ -8,13 +8,20 @@ import com.fasterxml.jackson.databind.JsonNode; |
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
import com.fasterxml.jackson.databind.node.ObjectNode; |
|
|
|
|
|
|
|
import actors.GameActor; |
|
|
|
import akka.actor.ActorRef; |
|
|
|
|
|
|
|
public class AIPlayer extends Player { |
|
|
|
private GameActor gameActor; |
|
|
|
|
|
|
|
public AIPlayer() { |
|
|
|
super(); |
|
|
|
} |
|
|
|
|
|
|
|
public AIPlayer(GameActor gameActor) { |
|
|
|
super(); |
|
|
|
this.gameActor = gameActor; |
|
|
|
} |
|
|
|
public void takeTurn(ActorRef out, GameState gameState) { |
|
|
|
// addPlayer2Notification |
|
|
|
BasicCommands.addPlayer2Notification(out, "My turn!", 2); |
|
|
@@ -30,11 +37,10 @@ public class AIPlayer extends Player { |
|
|
|
((ObjectNode) message).put("player", "AI"); |
|
|
|
// then send it to the GameActor: |
|
|
|
try { |
|
|
|
gameState.gameActor.processMessage("endturnclicked", message); |
|
|
|
this.gameActor.processMessage("endturnclicked", message); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
// gameState.gameActor.receive(message); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|