Package de.creepsmash.client.tower

Examples of de.creepsmash.client.tower.FindCreepStrategy


            AbstractTower t;
            t = (AbstractTower) context.selectTower();
            System.out.println("test: " + t.isReady());
            if (t.isReady()) {
            if (weakStrategyButton.getModel().isSelected()) {
              FindCreepStrategy fcs = new FindWeakestCreep(t);
              fcs.setCreepLock(lockCreepButton.getModel()
                  .isSelected());
              context.setStrategy(fcs);
            } else {
              weakStrategyButton.setSelected(true);
            }} else
              weakStrategyButton.setSelected(false);
          }
        });

    hardStrategyButton
        .addActionListener(new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            AbstractTower t;
            t = (AbstractTower) context.selectTower();
            if (t.isReady()) {
            if (hardStrategyButton.getModel().isSelected()) {
              FindCreepStrategy fcs = new FindStrongestCreep(t);
              fcs.setCreepLock(lockCreepButton.getModel()
                  .isSelected());
              context.setStrategy(fcs);
            } else {
              hardStrategyButton.setSelected(true);
            }} else
              hardStrategyButton.setSelected(false);
          }
        });

    closeStrategyButton
        .addActionListener(new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            AbstractTower t;
            t = (AbstractTower) context.selectTower();
            if (t.isReady()) {
            if (closeStrategyButton.getModel().isSelected()) {
              FindCreepStrategy fcs = new FindClosestCreep(t);
              fcs.setCreepLock(lockCreepButton.getModel()
                  .isSelected());
              context.setStrategy(fcs);
            } else {
              closeStrategyButton.setSelected(true);
            }} else
              closeStrategyButton.setSelected(false);
          }
        });

    fastestStrategyButton
        .addActionListener(new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            AbstractTower t;
            t = (AbstractTower) context.selectTower();
            if (t.isReady()) {
            if (fastestStrategyButton.getModel().isSelected()) {
              FindCreepStrategy fcs = new FindFastestCreep(t);
              fcs.setCreepLock(lockCreepButton.getModel()
                  .isSelected());
              context.setStrategy(fcs);
            } else {
              fastestStrategyButton.setSelected(true);
            }} else
              fastestStrategyButton.setSelected(false);
          }
        });

    lockCreepButton.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        AbstractTower t;
        t = (AbstractTower) context.getSelectedTower();
        if (t.isReady()) {
        FindCreepStrategy fcs = null;
        if (fastestStrategyButton.getModel().isSelected())
          fcs = new FindFastestCreep(t);
        if (closeStrategyButton.getModel().isSelected())
          fcs = new FindClosestCreep(t);
        if (hardStrategyButton.getModel().isSelected())
          fcs = new FindStrongestCreep(t);
        if (weakStrategyButton.getModel().isSelected())
          fcs = new FindWeakestCreep(t);
        fcs.setCreepLock(lockCreepButton.getModel().isSelected());
        context.setStrategy(fcs);
        } else
          lockCreepButton.setSelected(false);
      }
    });
View Full Code Here


      gamePanel.setLastTowerInfoPanel(gamePanel.getNoInfoPanel());
      gamePanel.getNoInfoPanel().setVisible(true);
    } else if (message.equalsIgnoreCase("upgrade")) {
      updateButton();
    } else if (message.equalsIgnoreCase("strategy")) {
      FindCreepStrategy fcs;
      fcs = ((AbstractTower) context.getSelectedTower()).getSelectedStrategy();
      weakStrategyButton.getModel().setSelected(
          fcs instanceof FindWeakestCreep);
      hardStrategyButton.getModel().setSelected(
          fcs instanceof FindStrongestCreep);
      closeStrategyButton.getModel().setSelected(
          fcs instanceof FindClosestCreep);
      fastestStrategyButton.getModel().setSelected(
          fcs instanceof FindFastestCreep);
      lockCreepButton.getModel().setSelected(fcs.isCreepLock());

    }
  }
View Full Code Here

    } else if (gm instanceof ChangeStrategyRoundMessage) {
      ChangeStrategyRoundMessage csm = (ChangeStrategyRoundMessage) gm;
      // find the tower we want to change
      for (Tower tower : towers) {
        if (tower.getId() == csm.getTowerId() && tower.isReady()) {
          FindCreepStrategy fcs = StrategyFactory.getStrategyForName(
              csm.getStrategyType(), tower);
          fcs.setCreepLock(csm.isLocked());
          ((AbstractTower) tower).setChangeStrategyTime((int)(csm.getRoundId() - roundId));
          ((AbstractTower) tower).setSelectedStrategy(fcs);
          break;
        }
      }
View Full Code Here

TOP

Related Classes of de.creepsmash.client.tower.FindCreepStrategy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.