|
|
|
|
@ -16,7 +16,8 @@ public class HealthEffect extends Subject3D {
|
|
|
|
|
private int sourceID;
|
|
|
|
|
private long currentTime;
|
|
|
|
|
private long flashInterval;
|
|
|
|
|
private AudioClip sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/warning.mp3").toExternalForm());
|
|
|
|
|
private AudioClip warningSound = new AudioClip(this.getClass().getResource("/visualiser/sounds/warning.mp3").toExternalForm());
|
|
|
|
|
private AudioClip deadSound = new AudioClip(this.getClass().getResource("/visualiser/sounds/dead1.wav").toExternalForm());
|
|
|
|
|
|
|
|
|
|
public HealthEffect(int sourceID, long currentTime){
|
|
|
|
|
super(createEffect(), 0);
|
|
|
|
|
@ -66,6 +67,21 @@ public class HealthEffect extends Subject3D {
|
|
|
|
|
return sourceID;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setSourceID(int id){
|
|
|
|
|
this.sourceID = id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void displayDeath(){
|
|
|
|
|
Image image = new Image(HealthEffect.class.getClassLoader().getResourceAsStream("images/warning2.png"));
|
|
|
|
|
PhongMaterial material = (PhongMaterial) this.getMesh().getMaterial();
|
|
|
|
|
material.setDiffuseColor(Color.web("#FFFFFF"));
|
|
|
|
|
material.setSpecularColor(Color.web("#000000"));
|
|
|
|
|
material.setDiffuseMap(image);
|
|
|
|
|
this.getMesh().setMaterial(material);
|
|
|
|
|
deadSound.play();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Flash the mesh view at a certain interval
|
|
|
|
|
* @param checkTime The current time of flash
|
|
|
|
|
@ -78,8 +94,8 @@ public class HealthEffect extends Subject3D {
|
|
|
|
|
this.setVisible(false);
|
|
|
|
|
} else {
|
|
|
|
|
if(playerBoat) {
|
|
|
|
|
sound.setVolume(0.1);
|
|
|
|
|
sound.play();
|
|
|
|
|
warningSound.setVolume(0.1);
|
|
|
|
|
warningSound.play();
|
|
|
|
|
}
|
|
|
|
|
this.setVisible(true);
|
|
|
|
|
}
|
|
|
|
|
|