diff options
Diffstat (limited to 'src/ch/epfl/xblast/client/GameState.java')
-rw-r--r-- | src/ch/epfl/xblast/client/GameState.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/ch/epfl/xblast/client/GameState.java b/src/ch/epfl/xblast/client/GameState.java index 2ac27e3..480c6a1 100644 --- a/src/ch/epfl/xblast/client/GameState.java +++ b/src/ch/epfl/xblast/client/GameState.java | |||
@@ -8,8 +8,11 @@ import ch.epfl.xblast.client.painter.ScorePainter; | |||
8 | import ch.epfl.xblast.client.painter.TimeLinePainter; | 8 | import ch.epfl.xblast.client.painter.TimeLinePainter; |
9 | 9 | ||
10 | import java.awt.*; | 10 | import java.awt.*; |
11 | import java.util.Collections; | ||
11 | import java.util.List; | 12 | import java.util.List; |
13 | import java.util.Map; | ||
12 | import java.util.Objects; | 14 | import java.util.Objects; |
15 | import java.util.stream.Collectors; | ||
13 | 16 | ||
14 | /** | 17 | /** |
15 | * The client representation of a game state. | 18 | * The client representation of a game state. |
@@ -131,7 +134,7 @@ public final class GameState { | |||
131 | } | 134 | } |
132 | 135 | ||
133 | /** | 136 | /** |
134 | * @return list containing all the images composing the actual score | 137 | * @return list containing all the images composing the score |
135 | */ | 138 | */ |
136 | public List<Image> scores() { | 139 | public List<Image> scores() { |
137 | return this.scores; | 140 | return this.scores; |
@@ -144,4 +147,12 @@ public final class GameState { | |||
144 | return this.ticks; | 147 | return this.ticks; |
145 | } | 148 | } |
146 | 149 | ||
150 | /** | ||
151 | * @return map of players' scores | ||
152 | */ | ||
153 | Map<PlayerID, Integer> playerScores() { | ||
154 | return Collections.unmodifiableMap(this.players.stream() | ||
155 | .collect(Collectors.toMap(Player::id, Player::lives))); | ||
156 | } | ||
157 | |||
147 | } | 158 | } |