Esempio n. 1
0
  public void keyPressed() { // NOPMD
    if ((phase != 2) || (changingLevel)) {
      return;
    }

    if ((key == 'b') || (key == 'B')) {
      final int whoAmI = BLUE;
      counterValue[whoAmI]++;
      final boolean check = thisInteractome.terra(whoAmI, INC_SIMPLE + (counterValue[whoAmI] / 5));
      fixCounterBoxWidth(whoAmI);
      splayer.playSample(whoAmI);
      if (check) {
        Logger.getInstance().debug("Found winner");
      }

    } else if ((key == 'g') || (key == 'G')) {
      final int whoAmI = GREEN;
      counterValue[whoAmI]++;
      final boolean check = thisInteractome.terra(whoAmI, INC_SIMPLE + (counterValue[whoAmI] / 5));
      fixCounterBoxWidth(whoAmI);
      splayer.playSample(whoAmI);
      if (check) {
        Logger.getInstance().debug("Found winner");
      }
    }
  }
Esempio n. 2
0
  private boolean redrawMorphome() {

    eraser(0, trans); // Fade Trick.
    if (trans > 25) {
      trans -= 25;
    }
    if (kare >= 120) {
      // glow();
      unlockControls = true;
    } // OpenGL Trick.
    kare++;

    return thisInteractome.display();
  }
Esempio n. 3
0
  /**
   * This method is called whenever the observed object is changed. An application calls an
   * <tt>Observable</tt> object's <code>notifyObservers</code> method to have all the object's
   * observers notified of the change.
   *
   * @param obs the observable object.
   * @param arg an argument passed to the <code>notifyObservers</code> method.
   */
  public void update(final Observable obs, final Object arg) { // NOPMD
    // Only interested to updates received from TOW Manager
    if (!(obs instanceof EventConsumer)) {
      return;
    }

    // Only interested for updates conveing an Event
    if (!(arg instanceof Event)) {
      return;
    }

    final Event event = (Event) arg;

    if (!event.getType().equals("TOW")) {
      // ignore it
      return;
    }

    // Extract team
    final int team = event.getGuardianID();
    if (team < 0 || team > 1) {
      Logger.getInstance().debug("Illegal");
      return;
    }

    Logger.getInstance().debug("Team " + event.getGuardianID() + event.getDescription());
    switch (stage) {
      case 0:
        if ((phase != 2) || (changingLevel)) {
          // Accept gesture only when we are playing a stage
          return;
        }
        Logger.getInstance().debug(" \n\n\t\tWELL DONE! team " + team);
        counterValue[team]++;
        fixCounterBoxWidth(team);
        thisInteractome.terra(team, INC_SIMPLE + (counterValue[team] / 10));
        // TODO play sample correct gesture
        splayer.playSample(team);
        break;

        // Gesture per team
      case 1:
        if ((phase != 2) || (changingLevel)) {
          // Accept gesture only when we are playing a stage
          return;
        }

        // check if gesture is correct
        if (event.getDescription().equals(curGesture[team])) {
          Logger.getInstance().debug(" \n\n\t\tWELL DONE! team " + team);
          thisInteractome.terra(team, INC_SIMPLE + (counterValue[team] / 10));
          counterValue[team]++;
          fixCounterBoxWidth(team);
          // TODO play sample correct gesture
          splayer.playSample(team);
        }

        break;

      default:
        break;
    }
  }
Esempio n. 4
0
  public void draw() { // NOPMD

    switch (phase) {
      case 0: // Show Starting SlidingBar.
        Logger.getInstance().debug("Case 0");
        if (starting.fadeIn(100, 0, 100, 0, 5, 0, 0)) {
          phase = 1;
        }
        textFont(fontCounter, 255);
        textSize(48);
        break;

      case 1: // Show Transition Effect.
        splayer.playSample(SamplePlayer.START_GAME + 2);

        if (createTransition(kare)) {
          phase = 2;
          changingLevel = false;
          kare = 0;
          trans = 250;
        }

        kare += 1;
        textFont(fontCounter, 255);
        textSize(48);
        break;

      case 2: // Show Actual Game Environment.
        if (redrawMorphome()) {
          counterValue[BLUE] = 0;
          counterValue[GREEN] = 0;
          phase = 3;
          changingLevel = true;
        }

        if (!changingLevel) {
          // draw gestures for both teams
          drawGestures();

          // draw gesture counter
          drawCounters();
        }

        break;

      case 3: // Make Everything White/Serene/Tranquil/Peaceful.
        eraser(255, 20);
        glow();
        unlockControls = false;
        if (thisInteractome.serene()) {
          phase = 4;
        }

        break;

      case 4: // Erase Everything for once.
        eraser(255, 255);
        phase = 5;
        break;

      case 5: // Show Ending SlidingBar. For Instance "http://finn.cti.gr"
        phase = 6;
        ending.fadeIn(50, 0, 10, (SCREENS - 1) * 50, 10, 10, 2);
        ending.reInitialize();
        break;

      case 6: // Uber Black Box.
        phase = 7;
        ending.fadeOut(50, 0, 0, 300, 30, teamWidth, 0, 0, 0, color(0, 0, 0), 1);
        ending.reInitialize();
        break;

      case 7: // Enwhiten.
        phase = 1;
        ending.fadeOut(25, 0, 0, 200, 10, teamWidth, 0, 0, 0, color(255, 255, 255), 1);
        createRandomness();
        thisInteractome = new Interactome(this, MAX_SIZE, MIN_SIZE, CIRCLE_COUNT, SCREENS, splayer);
        // initializeTitles(); //starting, ending
        kare = 0;
        trans = 0;
        break;

      default:
        break;
    }
  }