예제 #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 ArrayList<Cell> sightTower(Team team) {
   ArrayList<Cell> c = new ArrayList<Cell>();
   Iterator i = tower.iterator();
   while (i.hasNext()) {
     Tower t = (Tower) i.next();
     if (t.getTeam() == team && t.isBroken() == false) c.addAll(t.getSight());
   }
   return c;
 }