/
StatusDisplay.java
78 lines (57 loc) · 1.82 KB
/
StatusDisplay.java
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Gibt ein Statusdisplay aus.
*/
public class StatusDisplay extends Actor {
private GameManager gameManager;
private Decision currentDecision;
long lastAdded = System.currentTimeMillis();
int count = 20;
int player = 0;
private static StatusDisplay instance;
public static StatusDisplay getInstance() {
return instance;
}
public StatusDisplay(GameManager gameManager) {
this.gameManager = gameManager;
instance = this;
}
/**
* Status updaten.
*/
public void updateStatus(Decision currentDecision) {
this.currentDecision = currentDecision;
}
/**
* Status-Anzeige zeichnen.
*/
public void act() {
}
public void rollDice(int Fields) {
count = 15;
System.out.println("RollDice");
if (!gameManager.getGameBoard().getSkipSleep()) {
int random = (Greenfoot.getRandomNumber(6) + 1);
int rotate = 0;
while (count < 1000) {
long curTime = System.currentTimeMillis();
GreenfootImage one = new GreenfootImage("images/" + random + ".png");
one.scale(60, 60);
this.setImage(one);
one.rotate(rotate);
rotate++;
getWorld().repaint();
if (curTime >= lastAdded + count) {
random = (Greenfoot.getRandomNumber(6) + 1);
rotate = 0;
count = count + 200;
lastAdded = curTime;
}
}
}
GreenfootImage two = new GreenfootImage("images/" + Fields + ".png");
two.scale(60, 60);
this.setImage(two);
getWorld().repaint();
}
}