Exemple #1
0
  @Override
  public void execute() {
    coolDownTimer.update();
    if (GameInfo.player.isDead() || GameInfo.player.IsGhost || ((FishEntity) mOwner).IsEnsnared)
      return;

    if (!isActive
        && Utility.areObjectsWithinRange(
            mOwner, GameInfo.player, 60 + 120 * mOwner.entityScale.getEffectValue())
        && coolDownTimer.isTimeUp()) {

      isActive = true;

      SpeedPowerUpAffect power =
          ObjectRegistry.superPool.affectSpeedPowerUpPool
              .get(); // ObjectRegistry.superPool.affectLurePowerUpPool.get();
      power.setTimeToFinish(POWER_DURATION);
      mOwner.addAffect(power);

      coolDownTimer.set(COOLDOWN_TIME);
      coolDownTimer.reset();
    }
    // makes sure affect is not applied twice
    // in case when coolDowntimer is faster than power duration
    else if (coolDownTimer.isTimeUp() && isActive) {
      isActive = false;
    }
  }
Exemple #2
0
  @Override
  public boolean checkCondition() {

    rate.update();
    boolean ret = rate.isTimeUp();

    if (ret) {
      rate.reset();
    }

    return ret;
  }
Exemple #3
0
 @Override
 public void reset() {
   coolDownTimer.set(1500);
   coolDownTimer.reset();
   isActive = false;
 }
Exemple #4
0
 @Override
 public void reset() {
   //        rate.reset();
   this.rate.setElapsed((long) (rate.getTargetTime() * .8));
   // mLastSpawnCount = 0;
 }