Пример #1
0
 @Override
 public void setBound(Vec2i topLeft, Vec2i dimensions) {
   super.setBound(topLeft, dimensions);
   _superTower.setLocation(topLeft);
   _superTower.setSize(new Vec2i(dimensions.y, dimensions.y));
   _text1.setLocation(new Vec2i(topLeft.x + dimensions.y + 10, topLeft.y));
   _text2.setLocation(new Vec2i(topLeft.x + dimensions.y + 10, topLeft.y + 20));
 }
Пример #2
0
 @Override
 public void onMouseClicked(Vec2i location) {
   Vec2i rectLocation = _superTower.getLocation();
   Vec2i rectSize = _superTower.getSize();
   if (location.x >= rectLocation.x
       && location.x <= rectLocation.x + rectSize.x
       && location.y >= rectLocation.y
       && location.y <= rectLocation.y + rectSize.y) {
     this.shortcut();
   }
 }
Пример #3
0
 @Override
 public void shortcut() {
   if (_board.getGold() - (Constants.SUPER_TOWER_COST - Constants.ADVANCED_TOWER_COST) >= 0) {
     _board.reduceGold(Constants.SUPER_TOWER_COST - Constants.ADVANCED_TOWER_COST);
     Tower tower = new SuperTower(_tile, _board);
     ArrayList<Tower> towers = _board.getTowers();
     towers.remove(_tower);
     towers.add(tower);
     _superTower.setBorderColor(Constants.UNSELECTED_COLOR);
     _board.clearSelection();
   }
 }
Пример #4
0
 @Override
 public void draw(Graphics2D aBrush) {
   _superTower.draw(aBrush);
   _text1.draw(aBrush);
   _text2.draw(aBrush);
 }