Exemple #1
0
 public void createTouchDownAction() {
   ParallelAction whenParallelAction = ActionFactory.parallel();
   for (Script s : scriptList) {
     if (s instanceof WhenTouchDownScript) {
       SequenceAction sequence = createActionSequence(s);
       whenParallelAction.addAction(sequence);
     }
   }
   look.addAction(whenParallelAction);
 }
Exemple #2
0
 public void createWhenScriptActionSequence(String action) {
   ParallelAction whenParallelAction = actionFactory.parallel();
   for (Script s : scriptList) {
     if (s instanceof WhenScript && (((WhenScript) s).getAction().equalsIgnoreCase(action))) {
       SequenceAction sequence = createActionSequence(s);
       whenParallelAction.addAction(sequence);
     }
   }
   look.setWhenParallelAction(whenParallelAction);
   look.addAction(whenParallelAction);
 }
Exemple #3
0
 public void createWhenNfcScriptAction(String uid) {
   ParallelAction whenParallelAction = ActionFactory.parallel();
   for (Script s : scriptList) {
     if (s instanceof WhenNfcScript) {
       WhenNfcScript whenNfcScript = (WhenNfcScript) s;
       if (whenNfcScript.isMatchAll() || whenNfcScript.getNfcTag().getNfcTagUid().equals(uid)) {
         SequenceAction sequence = createActionSequence(s);
         whenParallelAction.addAction(sequence);
       }
     }
   }
   // TODO: quick fix for faulty behaviour - nfc action triggers again after touchevents
   // look.setWhenParallelAction(whenParallelAction);
   look.addAction(whenParallelAction);
 }
Exemple #4
0
  public Bananas(Vector2 origin, Vector2 destination, float speed, boolean large) {
    super(origin, destination, speed, "actors/banana.png");
    isLarge = large;

    textureRegion.setRegion(0, 0, WIDTH, HEIGHT);

    if (isLarge) setOrigin(WIDTH / 2, HEIGHT / 2);
    else setOrigin(WIDTH / 2 / 2, HEIGHT / 2 / 2);

    // Movimiento.
    ParallelAction pa = new ParallelAction();
    pa.addAction(Actions.moveTo(destination.x, destination.y, speed));
    pa.addAction(Actions.rotateBy(MathUtils.random(-360 * 4, 360 * 4), speed));
    addAction(pa);
  }