From 0769993db09bbcfe328d3611405151cfb09357e8 Mon Sep 17 00:00:00 2001 From: Timothée Floure Date: Mon, 2 May 2016 14:24:28 +0200 Subject: Add the client's GameState --- src/ch/epfl/xblast/client/GameState.java | 123 +++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 src/ch/epfl/xblast/client/GameState.java diff --git a/src/ch/epfl/xblast/client/GameState.java b/src/ch/epfl/xblast/client/GameState.java new file mode 100644 index 0000000..154a452 --- /dev/null +++ b/src/ch/epfl/xblast/client/GameState.java @@ -0,0 +1,123 @@ +package ch.epfl.xblast.client; + +import ch.epfl.xblast.PlayerID; +import ch.epfl.xblast.SubCell; + +import java.awt.*; +import java.util.List; + +/** + * @author Timothée FLOURE (257420) + */ +public class GameState { + private final List players; + private final List board; + private final List explosions; + private final List scores; + private final List ticks; + + /** + * Player. + */ + public static final class Player { + private final PlayerID id; + private final int lives; + private final SubCell position; + private final Image image; + + /** + * Instantiates a new Player. + * + * @param id id of the player + * @param lives number of lives of the player + * @param position position of the player + * @param image image related to the actual state of the player + */ + public Player(PlayerID id, int lives, SubCell position, Image image) { + this.id = id; + this.lives = lives; + this.position = position; + this.image = image; + } + + /** + * @return the player ID + */ + public PlayerID id() { + return this.id; + } + + /** + * @return the number of lives of the player + */ + public int lives() { + return this.lives; + } + + /** + * @return the position of the player + */ + public SubCell position() { + return this.position; + } + + /** + * @return the image related to the actual state of the player + */ + public Image image() { + return this.image; + } + } + + /** + * Instantiates a new GameState. + * + * @param players list containing the players + * @param board list containing all the images composing the board + * @param explosions list containing all the images composing the blasts and the bombs + * @param scores list containing all the images composing the actual score + * @param ticks list containing all the images composing the time "line" + */ + public GameState(List players, List board, List explosions, List scores, List ticks) { + this.players = players; + this.board = board; + this.explosions = explosions; + this.scores = scores; + this.ticks = ticks; + } + + /** + * @return list containing the players + */ + public List players() { + return this.players; + } + + /** + * @return list containing all the images composing the board + */ + public List board() { + return this.board; + } + + /** + * @return ist containing all the images composing the blasts and the bombs + */ + public List explosions() { + return this.explosions; + } + + /** + * @return list containing all the images composing the actual score + */ + public List scores() { + return this.scores; + } + + /** + * @return list containing all the images composing the time "line" + */ + public List ticks() { + return this.ticks; + } +} -- cgit v1.2.3