Exemplo n.º 1
0
 /**
  * Returns an {@code Actor} of the given class, regardless of the location on the {@code World} ,
  * or null if there is none. If there are multiple possible {@code Actor} that could be returned,
  * an arbitrary {@code Actor} is returned.
  *
  * @param <T> the generic type of the class to be returned
  * @param cls the {@code Class<T extends Actor>} of the {@code Actor} to be returned
  * @return an {@code Actor} of the given class
  */
 public <T extends Actor> T getActor(Class<T> cls) {
   return Lambda.first(Lambda.filterType(register, cls));
 }
Exemplo n.º 2
0
 /**
  * Returns an {@code Actor} of the given class located at (x, y), or null if there is none. If
  * there are multiple possible {@code Actor} that could be returned, an arbitrary {@code Actor} is
  * returned.
  *
  * @param <T> the generic type of the class to be returned
  * @param cls the {@code Class<T extends Actor>} of the {@code Actor} to be returned
  * @param x the x location being queried
  * @param y the y location being queried
  * @return an {@code Actor} of the given class located at (x, y)
  */
 public <T extends Actor> T getActorAt(Class<T> cls, int x, int y) {
   return Lambda.first(Lambda.filterType(grid[x][y].actors, cls));
 }