Example #1
0
 @Override
 public void actionPerformed(ActionEvent e) {
   /// TODO Auto-generated method stub
   if (e.getSource() == timer) {
     if (influTank.army == 1) {
       for (Tank otherTank : map.layer_3_CT) {
         if (otherTank.tankState == 5) otherTank.tankState = otherTank.tempState;
       }
     } else {
       for (Tank otherTank : map.layer_3_UT) {
         if (otherTank.tankState == 5) otherTank.tankState = otherTank.tempState;
       }
     }
     timer.stop();
     timer = null;
   } else {
     state++;
   }
 }
Example #2
0
 public void use(Tank tank) {
   amou--;
   if (tank.tools[tank.currentTool].amou == 0) {
     boolean count = false;
     for (int i = 0; i < tank.tools.length; i++) {
       if (tank.tools[i].amou != 0) {
         count = true;
         break;
       }
     }
     if (count) {
       do {
         tank.currentTool++;
         if (tank.currentTool == 7) tank.currentTool = 0;
       } while (tank.tools[tank.currentTool].amou == 0);
     } else {
       tank.currentTool = -1;
     }
   }
   LaserBomb laserBomb = new LaserBomb(tank.coordX, tank.coordY, tank.map, tank.direction, tank);
   tank.map.layer_5.add(laserBomb);
 }
Example #3
0
  public void work(Tank tank) {

    if (tank.army == 1) {
      for (Tank otherTank : map.layer_3_CT) {
        if (otherTank.tankState != 5) {
          otherTank.tempState = otherTank.tankState;
          otherTank.tankState = 5;
        }
      }
      timer = new Timer(12000, this);
      timer.start();
    } else {
      for (Tank otherTank : map.layer_3_UT) {
        if (otherTank.tankState != 5) {
          otherTank.tempState = otherTank.tankState;
          otherTank.tankState = 5;
        }
      }
      timer = new Timer(5000, this);
      timer.start();
    }
    influTank = tank;
    life--;
  }