示例#1
0
  /**
   * Constructor.
   *
   * @param hitObject the associated HitObject
   * @param game the associated Game object
   * @param data the associated GameData object
   * @param color the color of this slider
   * @param comboEnd true if this is the last hit object in the combo
   */
  public Slider(HitObject hitObject, Game game, GameData data, Color color, boolean comboEnd) {
    this.hitObject = hitObject;
    this.game = game;
    this.data = data;
    this.color = color;
    this.comboEnd = comboEnd;
    updatePosition();

    // slider time calculations
    this.sliderTime = game.getBeatLength() * (hitObject.getPixelLength() / sliderMultiplier) / 100f;
    this.sliderTimeTotal = sliderTime * hitObject.getRepeatCount();

    // ticks
    float tickLengthDiv =
        100f * sliderMultiplier / sliderTickRate / game.getTimingPointMultiplier();
    int tickCount = (int) Math.ceil(hitObject.getPixelLength() / tickLengthDiv) - 1;
    if (tickCount > 0) {
      this.ticksT = new float[tickCount];
      float tickTOffset = 1f / (tickCount + 1);
      float t = tickTOffset;
      for (int i = 0; i < tickCount; i++, t += tickTOffset) ticksT[i] = t;
    }
  }