Ejemplo n.º 1
0
 @Override
 public void attack(Board b) {
   fireTime = (fireTime + 1) % 20;
   if (fireTime == 0) {
     List<Creep> targets = b.getCreepsNear(b.getSquareFor(this.location), this.range);
     Creep target = null;
     if (!targets.isEmpty()) {
       target = targets.get(0);
       Star h = new Star(target, (Point) this.location.clone());
       this.bullets.add(h);
       AudioStream audioStream;
       try {
         audioStream =
             new AudioStream(NarwhalMain.class.getResourceAsStream("sound/StarShoot.wav"));
         final AudioPlayer player = AudioPlayer.player;
         player.start(audioStream);
       } catch (FileNotFoundException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
       } catch (IOException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
       }
     }
   }
 }
Ejemplo n.º 2
0
 public void enter(int floor, Person p) {
   original(floor, p);
   if (weight > MAX_WEIGHT) {
     System.out.println("Stop [LoadWeigthByPass]");
     LBPOkToGo = false;
     blockEnter = true;
     alarm.start(as);
   }
 }
Ejemplo n.º 3
0
 public void leave(Person p) {
   original(p);
   if (weight <= MAX_WEIGHT) {
     alarm.stop(as);
     System.out.println("Start [LoadWeigthByPass]");
     LBPOkToGo = true;
     blockEnter = false;
   }
 }
Ejemplo n.º 4
0
  public static void music(char gameResult) {
    AudioPlayer MGP = AudioPlayer.player;
    AudioStream BGM, BGM1;
    AudioData MD;

    ContinuousAudioDataStream loop = null;

    try {
      InputStream winAudio = new FileInputStream("Audio/winrevised.wav");
      InputStream loseAudio = new FileInputStream("Audio/loserevised.wav");
      BGM = new AudioStream(winAudio);
      BGM1 = new AudioStream(loseAudio);
      if (gameResult == 'w') AudioPlayer.player.start(BGM);
      else if (gameResult == 'l') AudioPlayer.player.start(BGM1);
      // MD = BGM.getData();
      // loop = new ContinuousAudioDataStream(MD);

    } catch (FileNotFoundException e) {
      e.printStackTrace();
    } catch (IOException error) {
      error.printStackTrace();
    }
    MGP.start(loop);
  }