-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPlayer.java
More file actions
44 lines (35 loc) · 897 Bytes
/
Player.java
File metadata and controls
44 lines (35 loc) · 897 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
public class Player {
private String playerId;
private int score;
private Action action;
private GameEventLogPublisher publisher;
//Accessors and Mutators
public String getPlayerId() {
return playerId;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
public Action getAction() {
return action;
}
public void setAction(Action action) {
this.action = action;
}
public GameEventLogPublisher getPublisher() {
return publisher;
}
public void doAction() {
if(action != null) {
action.execute();
}
}
public Player(String playerId, GameEventLogPublisher publisher) {
this.playerId = playerId;
this.score = 0;
this.publisher = publisher;
}
}