diff options
author | Timothée Floure | 2016-05-02 14:24:28 +0200 |
---|---|---|
committer | Timothée Floure | 2016-05-02 14:24:28 +0200 |
commit | 0769993db09bbcfe328d3611405151cfb09357e8 (patch) | |
tree | c61cf3e207367cebcdf3aabcf33f8abfdf5a0ddc /src/ch | |
parent | 7e11b5a58a9f34049a5078139446ca080ff9b50b (diff) | |
download | xblast-0769993db09bbcfe328d3611405151cfb09357e8.tar.gz |
Add the client's GameState
Diffstat (limited to 'src/ch')
-rw-r--r-- | src/ch/epfl/xblast/client/GameState.java | 123 |
1 files changed, 123 insertions, 0 deletions
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 @@ | |||
1 | package ch.epfl.xblast.client; | ||
2 | |||
3 | import ch.epfl.xblast.PlayerID; | ||
4 | import ch.epfl.xblast.SubCell; | ||
5 | |||
6 | import java.awt.*; | ||
7 | import java.util.List; | ||
8 | |||
9 | /** | ||
10 | * @author Timothée FLOURE (257420) | ||
11 | */ | ||
12 | public class GameState { | ||
13 | private final List<Player> players; | ||
14 | private final List<Image> board; | ||
15 | private final List<Image> explosions; | ||
16 | private final List<Image> scores; | ||
17 | private final List<Image> ticks; | ||
18 | |||
19 | /** | ||
20 | * Player. | ||
21 | */ | ||
22 | public static final class Player { | ||
23 | private final PlayerID id; | ||
24 | private final int lives; | ||
25 | private final SubCell position; | ||
26 | private final Image image; | ||
27 | |||
28 | /** | ||
29 | * Instantiates a new Player. | ||
30 | * | ||
31 | * @param id id of the player | ||
32 | * @param lives number of lives of the player | ||
33 | * @param position position of the player | ||
34 | * @param image image related to the actual state of the player | ||
35 | */ | ||
36 | public Player(PlayerID id, int lives, SubCell position, Image image) { | ||
37 | this.id = id; | ||
38 | this.lives = lives; | ||
39 | this.position = position; | ||
40 | this.image = image; | ||
41 | } | ||
42 | |||
43 | /** | ||
44 | * @return the player ID | ||
45 | */ | ||
46 | public PlayerID id() { | ||
47 | return this.id; | ||
48 | } | ||
49 | |||
50 | /** | ||
51 | * @return the number of lives of the player | ||
52 | */ | ||
53 | public int lives() { | ||
54 | return this.lives; | ||
55 | } | ||
56 | |||
57 | /** | ||
58 | * @return the position of the player | ||
59 | */ | ||
60 | public SubCell position() { | ||
61 | return this.position; | ||
62 | } | ||
63 | |||
64 | /** | ||
65 | * @return the image related to the actual state of the player | ||
66 | */ | ||
67 | public Image image() { | ||
68 | return this.image; | ||
69 | } | ||
70 | } | ||
71 | |||
72 | /** | ||
73 | * Instantiates a new GameState. | ||
74 | * | ||
75 | * @param players list containing the players | ||
76 | * @param board list containing all the images composing the board | ||
77 | * @param explosions list containing all the images composing the blasts and the bombs | ||
78 | * @param scores list containing all the images composing the actual score | ||
79 | * @param ticks list containing all the images composing the time "line" | ||
80 | */ | ||
81 | public GameState(List<Player> players, List<Image> board, List<Image> explosions, List<Image> scores, List<Image> ticks) { | ||
82 | this.players = players; | ||
83 | this.board = board; | ||
84 | this.explosions = explosions; | ||
85 | this.scores = scores; | ||
86 | this.ticks = ticks; | ||
87 | } | ||
88 | |||
89 | /** | ||
90 | * @return list containing the players | ||
91 | */ | ||
92 | public List<Player> players() { | ||
93 | return this.players; | ||
94 | } | ||
95 | |||
96 | /** | ||
97 | * @return list containing all the images composing the board | ||
98 | */ | ||
99 | public List<Image> board() { | ||
100 | return this.board; | ||
101 | } | ||
102 | |||
103 | /** | ||
104 | * @return ist containing all the images composing the blasts and the bombs | ||
105 | */ | ||
106 | public List<Image> explosions() { | ||
107 | return this.explosions; | ||
108 | } | ||
109 | |||
110 | /** | ||
111 | * @return list containing all the images composing the actual score | ||
112 | */ | ||
113 | public List<Image> scores() { | ||
114 | return this.scores; | ||
115 | } | ||
116 | |||
117 | /** | ||
118 | * @return list containing all the images composing the time "line" | ||
119 | */ | ||
120 | public List<Image> ticks() { | ||
121 | return this.ticks; | ||
122 | } | ||
123 | } | ||