Exemplo n.º 1
0
 @Override
 public void update(int ms) {
   super.update(ms);
   if (!isComplete()) {
     if (stepOn >= codes.length) {
       coffeeBrew.updateTimer(ms);
     }
   }
 }
Exemplo n.º 2
0
  @Override
  public void render(Graphics2D g2) {
    super.render(g2);
    g2.setColor(Color.BLACK);
    g2.fillRect(0, 0, 400, 300);
    g2.drawImage(coffeeMachineImage, 100, 0, null);
    BufferedImage img = null;
    if (coffeeBrew.getProgress() < coffeeBrew.getTargetNumber() / 3) {
      img = images[0];
    } else if (coffeeBrew.getProgress() < (coffeeBrew.getTargetNumber() / 3) * 2) {
      img = images[1];
    } else if (coffeeBrew.getProgress() < coffeeBrew.getTargetNumber()) {
      img = images[2];
    } else {
      img = images[3];
    }
    if (isComplete()) {
      img = images[3]; // show full thing when it's complete
    }
    g2.drawImage(img, 100, 0, null);
    if (stepOn < 3) {
      g2.drawImage(images[6 + stepOn], 100 + (30 * stepOn), 60, null);
    }
    if (stepOn == codes.length && !isComplete()) {
      // show brewing prompt when coffee is being made
      g2.drawImage(images[5], 120, 60, null);
    }

    // draw completed prompt on completion
    if (isComplete()) {
      g2.drawImage(images[4], 0, 0, null);
    }
  }
Exemplo n.º 3
0
 public MakeCoffeeTask(GameState stateInside) {
   super(stateInside, "Make coffee");
   images =
       new BufferedImage[] {
         stateInside.getAssetManager().getImage("coffeepot1"),
         stateInside.getAssetManager().getImage("coffeepot2"),
         stateInside.getAssetManager().getImage("coffeepot3"),
         stateInside.getAssetManager().getImage("coffeepot4"), // 3
         stateInside.getAssetManager().getImage("taskCompletePrompt"),
         stateInside.getAssetManager().getImage("brewingPrompt"), // 5
         stateInside.getAssetManager().getImage("fKeyPrompt"),
         stateInside.getAssetManager().getImage("pKeyPrompt"),
         stateInside.getAssetManager().getImage("oKeyPrompt"),
       };
   coffeeMachineImage = stateInside.getAssetManager().getImage("coffeepotBackground");
   coffeeBrew.setAction(
       new TimerAction() {
         @Override
         public void intervalComplete() {
           setComplete(true);
           coffeeBrew.setStopped(true);
         }
       });
 }
Exemplo n.º 4
0
 @Override
 public void resetForDay() {
   stepOn = 0;
   coffeeBrew.resetManually();
   setComplete(false);
 }