-
Notifications
You must be signed in to change notification settings - Fork 3
/
FlowFieldRunner.pde
59 lines (53 loc) · 1.14 KB
/
FlowFieldRunner.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
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
class FlowFieldRunner
{
ArrayList<ParticlesLayer> layers;
ParticlesLayer currentLayer;
int currentLayerIndex = -1;
boolean start = true;
String sampleName = "<none>";
FlowFieldRunner()
{
layers = new ArrayList<ParticlesLayer>();
}
void addLayer(ParticlesLayer pl)
{
if( currentLayerIndex == -1)
{
currentLayerIndex = 0;
currentLayer = pl;
}
layers.add(pl);
}
void update()
{
if(start)
{
this.start = false;
println("Layer "+(currentLayerIndex+1)+" started");
currentLayer.init();
}
if( currentLayer.dead)
{
if( currentLayerIndex < layers.size()-1)
{
println("Layer "+(currentLayerIndex+1)+" done");
currentLayerIndex++;
println("Layer "+(currentLayerIndex+1)+" started");
currentLayer = layers.get(currentLayerIndex);
currentLayer.init();
//currentLayer.update();
}
else
{
println("Layer "+(currentLayerIndex+1)+" done");
noLoop();
println("All layers drawn :-)");
}
}
else
{
// update current layer
currentLayer.update();
}
}
}