예제 #1
0
  protected static Animation.Value onScaleY(final Layer layer) {
    Asserts.checkNotNull(layer);
    return new Animation.Value() {
      public float initial() {
        return layer.scaleY();
      }

      public void set(float value) {
        layer.setScaleY(value);
      }
    };
  }
예제 #2
0
  /** Starts a tween on the supplied layer's transparency. */
  public Animation.One tweenAlpha(final Layer layer) {
    Asserts.checkNotNull(layer);
    return tween(
        new Animation.Value() {
          public float initial() {
            return layer.alpha();
          }

          public void set(float value) {
            layer.setAlpha(value);
          }
        });
  }
예제 #3
0
  /**
   * Tweens the volume of the supplied sound. Useful for fade-ins and fade-outs. Note, this does not
   * play or stop the sound, those must be enacted separately.
   */
  public Animation.One tweenVolume(final Sound sound) {
    Asserts.checkNotNull(sound);
    return tween(
        new Animation.Value() {
          public float initial() {
            return sound.volume();
          }

          public void set(float value) {
            sound.setVolume(value);
          }
        });
  }
예제 #4
0
  /**
   * Notes the specified piecement placement, assigns it a claim group and propagates its claim
   * information to connected tiles. The tile placement associated with this piecen must have
   * already been added via {@link #addPlacement}.
   */
  public void addPiecen(Piecen piecen) {
    _piecens.put(piecen.loc, piecen);

    // make sure a play exists at the appropriate location
    Placement play =
        Asserts.checkNotNull(
            _plays.get(piecen.loc), "Piecen played at location where no tile exists? %s", piecen);

    List<TileFeature> flist = Lists.newArrayList();
    enumerateGroup(play, play.getFeature(piecen.featureIdx), flist);
    int claimGroup = ++_claimGroupCounter;
    for (TileFeature feat : flist) {
      // one of these calls will result in this piecen's claim group being mapped
      getClaim(feat.play).setClaimGroup(feat.feature, claimGroup);
    }
  }
예제 #5
0
파일: Sprite.java 프로젝트: rfabbri/pet
 /** Set the current sprite via the sprite's id. */
 public void setSprite(String id) {
   setSprite(Asserts.checkNotNull(spriteIdMap.get(id), "Invalid sprite id"));
 }