-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTimerClass.java~
More file actions
40 lines (35 loc) · 1.33 KB
/
TimerClass.java~
File metadata and controls
40 lines (35 loc) · 1.33 KB
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
class TimerClass
{
static Thread timerthread;
static int thetime = 0;
public TimerClass()
{
timerthread = new Thread(new Runnable()
{
public void run()
{
//actions here when run
while(true) //r until the game ends and stuff
{
thetime = 1; // i'm cool with that (keep in mind all towers might fire since 0%n == 0 always)
while (!LSD.waveDone)
{
for(int a = 0;a<LSD.towers.size();a++)// or use the ratelist
{
if(thetime%LSD.towers.get(a).getPeriod()==0)//modded is zero
{
LSD.towers.get(a).fire();
}
}
if(thetime==Integer.MAX_VALUE)
thetime=1;
thetime++;
try {Thread.sleep(1);} catch(Exception e) {} //0.01 second
}
try {Thread.sleep(10);} catch(Exception e) {} //0.01 second
}
}
});
timerthread.start();
}
}