-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.java
More file actions
35 lines (29 loc) · 706 Bytes
/
Copy pathPlayer.java
File metadata and controls
35 lines (29 loc) · 706 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
package gamelevel;
public class Player {
PlayerLevel level;
public Player() {
level = new BeginnerLevel();
level.showLevelMessage();
}
public PlayerLevel getLevel() {
return level;
}
public void upgradeLevel(PlayerLevel level) {
this.level = level;
level.showLevelMessage();
}
public void play() {
if (level instanceof BeginnerLevel) {
level.go(1);
}
else if (level instanceof AdvancedLevel) {
level.go(2);
}
else if (level instanceof SuperLevel) {
level.go(3);
}
else {
System.out.println("level error");
}
}
}