2021-04-29 17:15:29 +00:00
|
|
|
package uulm.teamname.marvelous.gamelibrary.gamelogic;
|
|
|
|
|
2021-04-30 19:48:48 +00:00
|
|
|
import uulm.teamname.marvelous.gamelibrary.IntVector2;
|
2021-04-29 17:15:29 +00:00
|
|
|
import uulm.teamname.marvelous.gamelibrary.entities.Entity;
|
2021-04-30 19:48:48 +00:00
|
|
|
import uulm.teamname.marvelous.gamelibrary.entities.EntityID;
|
|
|
|
import uulm.teamname.marvelous.gamelibrary.entities.StoneType;
|
2021-04-29 17:15:29 +00:00
|
|
|
|
2021-04-30 18:54:34 +00:00
|
|
|
import java.util.Iterator;
|
2021-04-29 17:15:29 +00:00
|
|
|
|
2021-04-30 18:54:34 +00:00
|
|
|
/** Represents a game state view containing getters for all the properties of a {@link GameState}. */
|
2021-04-29 17:15:29 +00:00
|
|
|
public class GameStateView {
|
2021-04-30 18:54:34 +00:00
|
|
|
/** The managed {@link GameState} */
|
2021-04-29 17:15:29 +00:00
|
|
|
private final GameState state;
|
|
|
|
|
2021-04-30 18:54:34 +00:00
|
|
|
/**
|
|
|
|
* Constructs a new {@link GameStateView}.
|
|
|
|
* @param state A reference to the state to be viewable
|
2021-04-29 17:15:29 +00:00
|
|
|
*/
|
|
|
|
public GameStateView(GameState state) {
|
|
|
|
this.state = state;
|
|
|
|
}
|
|
|
|
|
2021-04-30 19:48:48 +00:00
|
|
|
public IntVector2 getMapSize() {
|
|
|
|
return state.mapSize;
|
|
|
|
}
|
2021-04-29 17:15:29 +00:00
|
|
|
|
2021-04-30 18:54:34 +00:00
|
|
|
public Iterator<Entity> getEntities() {
|
|
|
|
return state.entities.getEntities();
|
2021-04-29 17:15:29 +00:00
|
|
|
}
|
2021-04-30 19:48:48 +00:00
|
|
|
|
|
|
|
public int getRoundNumber() {
|
|
|
|
return state.roundNumber;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getTurnNumber() {
|
|
|
|
return state.turnNumber;
|
|
|
|
}
|
|
|
|
|
|
|
|
public EntityID getActiveCharacter() {
|
|
|
|
return state.activeCharacter;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isWon() {
|
|
|
|
return state.won;
|
|
|
|
}
|
|
|
|
|
2021-05-01 17:47:19 +00:00
|
|
|
public int getStoneCooldown(StoneType stone) {
|
|
|
|
return state.stoneCooldown.getCooldown(stone);
|
2021-04-30 19:48:48 +00:00
|
|
|
}
|
2021-04-29 17:15:29 +00:00
|
|
|
}
|