コード例 #1
0
ファイル: GameMatch.java プロジェクト: VuDinh/SA
 public Character getCharacterByCord(int row, int col) {
   for (Iterator it = team2.iterator(); it.hasNext(); ) {
     Player player = (Player) it.next();
     if (player.getHero().isThere(row, col)) {
       return player.getHero();
     }
   }
   for (Iterator it = team1.iterator(); it.hasNext(); ) {
     Player player = (Player) it.next();
     if (player.getHero().isThere(row, col)) {
       return player.getHero();
     }
   }
   for (Iterator it = monsters.iterator(); it.hasNext(); ) {
     Monster monster = (Monster) it.next();
     if (monster.getRow() == row && monster.getCol() == col) {
       return monster;
     }
   }
   for (Iterator it = tower.iterator(); it.hasNext(); ) {
     Tower t = (Tower) it.next();
     if (t.getSelf().contains(new Cell(row, col))) {
       return t;
     }
   }
   return null;
 }
コード例 #2
0
ファイル: GameMatch.java プロジェクト: VuDinh/SA
 public void drawHeroes(Graphics g, int scrollX, int scrollY) {
   for (Iterator it = team2.iterator(); it.hasNext(); ) {
     Player player = (Player) it.next();
     player.getHero().draw(g, scrollX, scrollY);
   }
   for (Iterator it = team1.iterator(); it.hasNext(); ) {
     Player player = (Player) it.next();
     player.getHero().draw(g, scrollX, scrollY);
   }
 }
コード例 #3
0
ファイル: GameMatch.java プロジェクト: VuDinh/SA
  public void drawHeroEffects(
      Graphics g, int scrollX, int scrollY, Cell selectedCell, Cell rangeCell) {
    for (Iterator it = team2.iterator(); it.hasNext(); ) {
      Player player = (Player) it.next();
      Hero tempHero = player.getHero();
      if (tempHero.getIsChosen() && tempHero.getStatus().equals(HeroStatus.standing)) {
        tempHero.drawRange(g, scrollX, scrollY);

      } else if (tempHero.getIsChosen() && tempHero.getStatus().equals(HeroStatus.attacking)) {
        tempHero
            .getCurrentSkill()
            .drawSkill(g, selectedCell, scrollX, scrollY, tempHero.getPanel());
        tempHero
            .getSkill(tempHero.getCurrentSkillIndex())
            .drawPath(g, rangeCell, scrollX, scrollY, tempHero.getPanel());
        tempHero
            .getSkill(tempHero.getCurrentSkillIndex())
            .drawPathOnHero(g, tempHero, rangeCell, scrollX, scrollY, tempHero.getPanel());
      }
      if (tempHero.getIsChosen()) {
        g.drawImage(
            tempHero.getCurrentSprite(),
            tempHero.getX() - scrollX,
            tempHero.getY() - scrollY,
            tempHero.getPanel());
      }
    }
    for (Iterator it = team1.iterator(); it.hasNext(); ) {
      Player player = (Player) it.next();
      Hero tempHero = player.getHero();
      if (tempHero.getIsChosen() && tempHero.getStatus().equals(HeroStatus.standing)) {
        tempHero.drawRange(g, scrollX, scrollY);

      } else if (tempHero.getIsChosen() && tempHero.getStatus().equals(HeroStatus.attacking)) {
        tempHero
            .getCurrentSkill()
            .drawSkill(g, selectedCell, scrollX, scrollY, tempHero.getPanel());
        tempHero
            .getSkill(tempHero.getCurrentSkillIndex())
            .drawPath(g, rangeCell, scrollX, scrollY, tempHero.getPanel());
        tempHero
            .getSkill(tempHero.getCurrentSkillIndex())
            .drawPathOnHero(g, tempHero, rangeCell, scrollX, scrollY, tempHero.getPanel());
      }
      if (tempHero.getIsChosen()) {
        g.drawImage(
            tempHero.getCurrentSprite(),
            tempHero.getX() - scrollX,
            tempHero.getY() - scrollY,
            tempHero.getPanel());
      }
    }
  }
コード例 #4
0
ファイル: GameMatch.java プロジェクト: VuDinh/SA
 public Player getPlayerByCord(int row, int col) {
   for (Iterator it = team2.iterator(); it.hasNext(); ) {
     Player player = (Player) it.next();
     if (player.getHero().isThere(row, col)) {
       return player;
     }
   }
   for (Iterator it = team1.iterator(); it.hasNext(); ) {
     Player player = (Player) it.next();
     if (player.getHero().isThere(row, col)) {
       return player;
     }
   }
   return null;
 }
コード例 #5
0
ファイル: GameMatch.java プロジェクト: VuDinh/SA
 public void setGameMap(GameMap gameMap) {
   for (Iterator it = team2.iterator(); it.hasNext(); ) {
     Player player = (Player) it.next();
     player.getHero().setPanel(gameMap);
     for (Skill skill : player.getHero().getAllSkills()) {
       skill.setPanel(gameMap);
     }
   }
   for (Iterator it = team1.iterator(); it.hasNext(); ) {
     Player player = (Player) it.next();
     player.getHero().setPanel(gameMap);
     for (Skill skill : player.getHero().getAllSkills()) {
       skill.setPanel(gameMap);
     }
   }
 }
コード例 #6
0
ファイル: GameMatch.java プロジェクト: VuDinh/SA
 public void resetMoveMap() {
   for (Iterator it = team2.iterator(); it.hasNext(); ) {
     Player player = (Player) it.next();
     int row = player.getHero().getRow();
     int col = player.getHero().getCol();
     Utilizer.MOVEMAP[row][col] = 12;
   }
   for (Iterator it = team1.iterator(); it.hasNext(); ) {
     Player player = (Player) it.next();
     // if(player.getSlotIndex()!=request.getSlotIndex())
     int row = player.getHero().getRow();
     int col = player.getHero().getCol();
     Utilizer.MOVEMAP[row][col] = 12;
   }
   for (Iterator it = monsters.iterator(); it.hasNext(); ) {
     Monster monster = (Monster) it.next();
     int row = monster.getRow();
     int col = monster.getCol();
     Utilizer.MOVEMAP[row][col] = 12;
   }
 }