Ejemplo n.º 1
0
 @Override
 public void render(SpriteBatch batch) {
   batch.draw(texture, x, y, width, height);
   Assets.getFont().getData().setScale(0.7f);
   Assets.getFont().setColor(Color.BLACK);
   Assets.getFont().draw(batch, "Generator", x - 20, y - 4);
   Assets.getFont().draw(batch, "" + cost, x + 4, y - 24);
   Assets.getFont().setColor(1.0f, 1.0f, 0.0f, 1.0f);
   Assets.getFont().getData().setScale(0.5f);
   Assets.getFont().draw(batch, "+  /" + (int) GeneratorTile.TIMEINTERVAL + "s", x + 2, y + 54);
   batch.draw(Assets.getRegion("resourceIcon"), x + 44, y - 38, 16, 16);
   batch.draw(Assets.getRegion("energyIcon"), x + 14, y + 40, 16, 16);
 }
Ejemplo n.º 2
0
 @Override
 public void onPlace(int x, int y, HUD hud) {
   if (hud.getAmountOfResources() < cost
       || (!(hud.getWorld().getTile(x, y) instanceof DirtTile)
           && !(hud.getWorld().getTile(x, y) instanceof GrassTile)
           && !(hud.getWorld().getTile(x, y) instanceof StoneTile))) return;
   if (!checkPlacement(x, y, hud.getWorld().getEntityManager())) return;
   hud.incResources(-cost);
   hud.addFoodTaker();
   Assets.playSound("place");
   hud.getWorld().setTile(x, y, new GeneratorTile());
 }
Ejemplo n.º 3
0
 public BuyGeneratorButton(float x, float y) {
   super(x, y, 64, 64, 400);
   texture = Assets.getRegion("generator.1");
 }