|
|
@@ -1,7 +1,12 @@
|
|
|
package gui.simulator.facilities;
|
|
|
|
|
|
+import java.awt.Color;
|
|
|
+import java.awt.Graphics2D;
|
|
|
+import java.awt.geom.GeneralPath;
|
|
|
import java.io.Serializable;
|
|
|
+import java.util.GregorianCalendar;
|
|
|
|
|
|
+import agenda.Act;
|
|
|
import agenda.Stage;
|
|
|
import gui.simulator.DrawEngine;
|
|
|
import gui.simulator.Images;
|
|
|
@@ -13,13 +18,18 @@ public class SimulatorStage extends DrawEngine implements Serializable {
|
|
|
private static Images.ImageType images = Images.ImageType.Tent;
|
|
|
private static String facilityName = "Stage";
|
|
|
private Stage stage;
|
|
|
+ private Act playingact;
|
|
|
+ private int movement1,movement2;
|
|
|
+ private long lastTime;
|
|
|
|
|
|
public SimulatorStage(int x, int y, Terrain terrain) {
|
|
|
super(images, x, y, 1, 0,SimulatorPane.Objects.STAGE, terrain);
|
|
|
+ changeLightbeam();
|
|
|
}
|
|
|
|
|
|
public SimulatorStage(int x, int y, double scale, double distance, Terrain terrain) {
|
|
|
super(images, x, y, scale, distance,SimulatorPane.Objects.STAGE, terrain);
|
|
|
+ changeLightbeam();
|
|
|
}
|
|
|
|
|
|
public String getFacilityName(){
|
|
|
@@ -33,4 +43,39 @@ public class SimulatorStage extends DrawEngine implements Serializable {
|
|
|
public Stage getStage() {
|
|
|
return stage;
|
|
|
}
|
|
|
+
|
|
|
+ public Act getPlayingact() {
|
|
|
+ return playingact;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setPlayingact(Act playingact) {
|
|
|
+ this.playingact = playingact;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void draw(Graphics2D g){
|
|
|
+ if(playingact != null){
|
|
|
+ if(System.currentTimeMillis() - lastTime > 1000)
|
|
|
+ changeLightbeam();
|
|
|
+ GeneralPath lightbeam = new GeneralPath();
|
|
|
+ int xobject = getWidth()/2;
|
|
|
+ int yobject = getHeight()-20;
|
|
|
+ lightbeam.moveTo(xobject-90, yobject);
|
|
|
+ lightbeam.lineTo(xobject-90-60+movement1, yobject+160);
|
|
|
+ lightbeam.lineTo(xobject-90+60+movement1, yobject+160);
|
|
|
+ lightbeam.lineTo(xobject-90, yobject);
|
|
|
+ lightbeam.moveTo(xobject+90, yobject);
|
|
|
+ lightbeam.lineTo(xobject+90-60+movement2, yobject+160);
|
|
|
+ lightbeam.lineTo(xobject+90+60+movement2, yobject+160);
|
|
|
+ lightbeam.lineTo(xobject+90, yobject);
|
|
|
+ lightbeam.closePath();
|
|
|
+ g.setColor(new Color(255,0,0,60));
|
|
|
+ g.fill(this.getAffineTransform().createTransformedShape(lightbeam));
|
|
|
+ }
|
|
|
+ super.draw(g);
|
|
|
+ }
|
|
|
+ public void changeLightbeam(){
|
|
|
+ lastTime = System.currentTimeMillis();
|
|
|
+ movement1 = (int) (Math.random()*70)-35;
|
|
|
+ movement2 = (int) (Math.random()*70)-35;
|
|
|
+ }
|
|
|
}
|