Java Upgrade Example

说明

java upgrade示例是从最受好评的开源项目中提取的实现代码,你可以参考下面示例的使用方式。

编程语言: Java

类/类型: Upgrade

示例#1
文件: Player.java项目: propra12-orga/gruppe21

 @Override
 public boolean collidesWithListener(Upgrade upgrade) {
   if ((Math.abs(upgrade.getPosX() - this.posX) < 50)
       && (Math.abs(upgrade.getPosY() - this.posY) < 50)) {
     return true;
   }
   return false;
 }

示例#2
文件: UpgradeWave.java项目: XXLuigiMario/MobArena

  public void grantItems(Arena arena, Player p, String className) {
    List<Upgrade> list = upgrades.get(className);
    if (list == null) return;

    if (giveAll) {
      for (Upgrade upgrade : list) {
        upgrade.upgrade(arena, p);
      }
    } else {
      int index = new Random().nextInt(list.size());
      list.get(index).upgrade(arena, p);
    }
  }

示例#3
文件: AnnotatedSchema.java项目: zhangyongjiang/SORMA

 public void upgradeDatabase(SqlExecutor executor, int oldVersion, int newVersion)
     throws Exception {
   Upgrade[] upgrades = contentProviderAnnotation.upgrades();
   for (Upgrade upgrade : upgrades) {
     if (upgrade.version() <= oldVersion || upgrade.version() > newVersion) {
       continue;
     }
     for (String sql : upgrade.SQLs()) {
       try {
         System.out.println("SORMA" + "\t" + "execute update " + sql);
         executor.execute(sql);
       } catch (Exception e) {
         throw new SormaException(e);
       }
     }
   }
 }

示例#4
文件: Player.java项目: propra12-orga/gruppe21

  /**
   * Handles the upgrade given by the giveUpgrade function
   *
   * @param upgrade
   */
  private void handleUpgrades(Upgrade upgrade) {
    Color tmpColor = upgrade.getColor();
    if ((tmpColor == Color.pink) && !maxBombs_used) {
      if (maxbombs < 4) {
        maxbombs++;
        maxBombs_used = true;
      }
    }
    if ((tmpColor == Color.blue) && !bombRadius_used) {
      if (bombradius < 3) {
        bombradius++;
        bombRadius_used = true;
      }
    }
    if (tmpColor == Color.cyan) {
      if (!shieldEqu) {
        shieldEqu = true;
      }
    }
    if (tmpColor == Color.magenta) {
      bombRemote = true;
    }
    if (tmpColor == Color.lightGray) {
      if (!immortal) {
        immortal = true;
        shieldProtection = false;
        animation.setCurrentAnimation("playerDown_immortal");
        immortalStartTime = System.nanoTime();
      }
    }

    if (maxBombs_used) {
      if (tmpColor == Color.pink) {
        maxBombs_used = false;
      }
    }

    if (bombRadius_used) {
      if (tmpColor == Color.blue) {
        bombRadius_used = false;
      }
    }
  }

示例#5
文件: Player.java项目: propra12-orga/gruppe21

 @Override
 public void giveUpgrade(Upgrade upgrade) {
   handleUpgrades(upgrade);
   upgrade.setDestroyed(true);
 }

展开阅读全文