Exemplo n.º 1
0
  // Override Behavior's stimulus method to handle the event
  public void processStimulus(Enumeration criteria) {

    // NOTE: This assumes 3 objects.  It should be generalized to
    // "n" objects.

    double val = alpha.value();
    if (val < 0.5) {
      double a = val * 2.0;
      weights[0] = 1.0 - a;
      weights[1] = a;
      weights[2] = 0.0;
    } else {
      double a = (val - 0.5) * 2.0;
      weights[0] = 0.0;
      weights[1] = 1.0f - a;
      weights[2] = a;
    }

    morph.setWeights(weights);

    // Set wakeup criteria for next time
    wakeupOn(w);
  }
Exemplo n.º 2
0
 public MorphingBehavior(Alpha a, Morph m) {
   alpha = a;
   morph = m;
   weights = morph.getWeights();
 }