forked from mperes/ZombieAttack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScore.pde
33 lines (26 loc) · 783 Bytes
/
Score.pde
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
class Score implements Comparable<Score> {
import java.util.UUID;
float time;
int score;
int kills;
UUID playerID;
Score(int score, float time, int kills, UUID playerID) {
this.score = score;
this.time = time;
this.kills = kills;
this.playerID = playerID;
}
String getTime() {
String secs = Integer.toString((int)((time / 1000) % 60));
String mins = Integer.toString((int)((time / 1000) / 60));
secs = (secs.length() < 2) ? "0"+secs : secs;
mins = (mins.length() < 2) ? "0"+mins : mins;
return mins+":"+secs;
}
int compareTo(Score anotherInstance) {
return anotherInstance.score - this.score;
}
String asCSV() {
return score + ";" + time + ";" + kills + ";" + playerID.toString();
}
}