예제 #1
0
    @Override
    public void update(Actor actor) {
      super.update(actor);

      // update the base animation
      Animation base = getBase((Mobile) actor);
      if (base != null && !base.isPlaying()) {
        base.start();
      }
    }
예제 #2
0
 /**
  * Returns a weighted random animation (unless one of the animations is already playing, in
  * which case the method will return that animation).
  */
 protected static Animation getWeightedAnimation(Animation[] anims, float[] weights) {
   if (anims.length == 0) {
     return null;
   }
   for (Animation anim : anims) {
     if (anim.isPlaying()) {
       return anim;
     }
   }
   return anims[RandomUtil.getWeightedIndex(weights)];
 }