public class GameEngine
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private Plot |
activePlot |
private java.util.List<AIPlayer> |
aiPlayers |
private Player |
currentPlayer |
private java.util.List<Player> |
humanPlayers |
private int |
mapHeight |
private int |
mapWidth |
private MarketPlace |
market |
private int |
phase |
private float |
PHASE_TIME_CONST |
private float |
phaseTime |
private Plot[] |
plots |
private boolean |
running |
Constructor and Description |
---|
GameEngine(java.util.ArrayList<Player> humanPlayers,
java.util.ArrayList<AIPlayer> aiPlayers,
int mapWidth,
int mapHeight)
This allows a new instance of the GameEngine object to be instantiated allow a game to be played.
|
Modifier and Type | Method and Description |
---|---|
Plot |
getActivePlot()
Gets the currently selected plot
|
java.util.List<AIPlayer> |
getAIPlayers()
Gets array list of AI players
|
Player |
getCurrentPlayer()
Returns the player whose current turn it is
|
java.util.List<Player> |
getHumanPlayers()
Gets the array list of human players
|
int |
getMapHeight()
Gets the height of the map as an integer
|
int |
getMapWidth()
Gets the width of the map as an integer
|
MarketPlace |
getMarket()
Returns the market object used by the game
|
int |
getPhase()
Gets the current phase
|
float |
getPhaseTime()
Gets the time remaining in the current phase
|
Plot[] |
getPlots()
Gets all of the plots for the game
|
boolean |
isRunning()
Checks to see if the game is running
|
void |
setActivePlot(Plot plot)
Sets the currently active plot to the plot passed to the function
|
void |
setPhase(int phase)
Sets the current phase to the value passed
|
void |
setPhaseTime(float phaseTime)
Sets the phase time to the phase time passed to the function
|
void |
start()
Starts the game
|
void |
stop()
Stops the game
|
void |
update(float deltaTime)
Updates the data in the game given a time since the last update
|
void |
updateTest() |
private java.util.List<Player> humanPlayers
private java.util.List<AIPlayer> aiPlayers
private Plot[] plots
private Plot activePlot
private MarketPlace market
private final int mapWidth
private final int mapHeight
private final float PHASE_TIME_CONST
private int phase
private Player currentPlayer
private boolean running
private float phaseTime
public GameEngine(java.util.ArrayList<Player> humanPlayers, java.util.ArrayList<AIPlayer> aiPlayers, int mapWidth, int mapHeight)
humanPlayers
- The list of human players who are player as Player objectsaiPlayers
- The list of ai players who are playing as AIPlayer objectsmapWidth
- The with of the mapmapHeight
- The height of the mappublic void start()
public boolean isRunning()
public void stop()
public void update(float deltaTime)
deltaTime
- Time since last updatepublic void updateTest()
public Plot[] getPlots()
public int getMapWidth()
public int getMapHeight()
public java.util.List<Player> getHumanPlayers()
public java.util.List<AIPlayer> getAIPlayers()
public Plot getActivePlot()
public void setActivePlot(Plot plot)
plot
- the plot which the active plot will be set topublic float getPhaseTime()
public void setPhaseTime(float phaseTime)
phaseTime
- The time the phase should be set topublic int getPhase()
public void setPhase(int phase)
phase
- Value phase should be set topublic Player getCurrentPlayer()
public MarketPlace getMarket()