-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathObjetLampe.pde
60 lines (56 loc) · 1.48 KB
/
ObjetLampe.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
60
class ObjetLampe extends Objet {
color[] couleurLampe;
boolean isOn = true;
ObjetLampe(PVector pos, PVector taille, float angle) {
// Lampe
add(new Partie(
new PVector(0, 0, 0),
new PVector(taille.x, taille.y, taille.z),
true));
// Support Muralle
add(new Partie(
new PVector(taille.x/6, 0, taille.z/6),
new PVector(2*taille.x/3, taille.y/3, 2*taille.z/3),
angle));
moveTo(pos);
}
ObjetLampe(PVector pos, PVector taille, float angle, color[] couleur) {
couleurLampe = couleur;
// Lampe
add(new Partie(
new PVector(0, 0, 0),
new PVector(taille.x, taille.y, taille.z),
true,
couleur[0])
.setEmissive(couleur[0])
);
// Support Muralle
add(new Partie(
new PVector(taille.x/6, 0, taille.z/6),
new PVector(2*taille.x/3, taille.y/3, 2*taille.z/3),
angle,
couleur[1])
.setEmissive(couleur[1])
);
moveTo(pos);
}
ObjetLampe(PVector pos, PVector taille, float angle, PImage[] texture) {
// Lampe
add(new Partie(
new PVector(0, 0, 0),
new PVector(taille.x, taille.y, taille.z),
true,
texture[0]));
// Support Muralle
add(new Partie(
new PVector(taille.x/6, 0, taille.z/6),
new PVector(2*taille.x/3, taille.y/3, 2*taille.z/3),
angle,
texture[1]));
moveTo(pos);
}
void switchLight() {
isOn = !isOn;
setEmissive((isOn) ? couleurLampe[0] : color(0));
}
}