-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBonus.java
42 lines (37 loc) · 1.34 KB
/
Bonus.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
import javafx.fxml.FXMLLoader;
import javafx.scene.paint.Color;
import javafx.scene.paint.PhongMaterial;
import javafx.scene.shape.MeshView;
import javafx.scene.transform.Rotate;
import java.awt.geom.Point2D;
import java.io.IOException;
public abstract class Bonus extends Divers{
protected String avantage;
public Bonus(Maze m, String a){
super(m);
avantage=a;
put();
}
public Bonus(Maze m, Point2D p,String a){
super(m,p);
avantage=a;
}
public String getAvantage(){return avantage;}
public MeshView initBonus() throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader();
PhongMaterial mat = new PhongMaterial();
if(avantage.equals("Piece")) {
fxmlLoader.setLocation(this.getClass().getResource("fxml/MegaCoin.fxml")); //mettre pieces ou bonus temps
mat.setSpecularColor(Color.LIGHTGOLDENRODYELLOW);
mat.setDiffuseColor(Color.YELLOW);
}else{
fxmlLoader.setLocation(this.getClass().getResource("fxml/sablier.fxml"));
mat.setSpecularColor(Color.MAROON);
mat.setDiffuseColor(Color.BROWN);
}
MeshView bonus = fxmlLoader.<MeshView>load();
bonus.setMaterial(mat);
bonus.setRotationAxis(Rotate.Z_AXIS);
return bonus;
}
}