aboutsummaryrefslogtreecommitdiff
path: root/src/ch/epfl/xblast/client/GameState.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/ch/epfl/xblast/client/GameState.java')
-rw-r--r--src/ch/epfl/xblast/client/GameState.java13
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;
8import ch.epfl.xblast.client.painter.TimeLinePainter; 8import ch.epfl.xblast.client.painter.TimeLinePainter;
9 9
10import java.awt.*; 10import java.awt.*;
11import java.util.Collections;
11import java.util.List; 12import java.util.List;
13import java.util.Map;
12import java.util.Objects; 14import java.util.Objects;
15import 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}