Пример #1
0
  /**
   * Gestion des événements des divers éléments du panel (menu, bouttons, etc.).
   *
   * @param ae l'événement associé à une action
   */
  public void actionPerformed(ActionEvent ae) {
    Object source = ae.getSource();
    Tower tour = null;

    if (source == bTourArcher) tour = new Tower_Archer();
    else if (source == bTourCanon) tour = new Tower_Canon();
    else if (source == bTourAntiAerienne) tour = new Tower_AntiAerial();
    else if (source == bTourDeGlace) tour = new Tower_Ice();
    else if (source == bTourDeFeu) tour = new Tower_Fire();
    else if (source == bTourDAir) tour = new Tower_Air();
    else if (source == bTourDeTerre) tour = new Tower_Earth();
    else if (source == bTourElectrique) tour = new Tower_Electric();
    else return;

    tour.setProprietaire(jeu.getJoueurPrincipal());

    edpt.tourSelectionnee(tour, Panel_InfoTour.MODE_ACHAT);
    edpt.setTourAAcheter(tour);
  }
Пример #2
0
 public void paintComponent(Graphics g) { // display
   if (isFirst) {
     myWidth = getWidth();
     myHeight = getHeight();
     define();
     isFirst = false;
   }
   g.clearRect(0, 0, getWidth(), getHeight());
   room.draw(g); // draw map
   store.draw(g); // draw sidebar
   // b.draw(g);
   theMinion.draw(g);
   if (to != null) { // tower selected movement
     to.draw(g, xval, yval, to);
   }
   for (Tower i : tplace) {
     i.draw(g, i);
   }
 }