Пример #1
0
 public boolean isDeletable() {
   if (deletable) return true;
   Vec3 camera = Camera.getPosition();
   Vec3 position = getModel().getPosition();
   if (position.getY() < camera.getY()) return false;
   float dy = Math.abs(camera.getY() - position.getY());
   return dy - getShape().getHeight() / 2
       > (1.3 * (1 / Constants.RATIO)); // Add a little marge just to be safe
 }
Пример #2
0
 public boolean isInView() {
   Vec3 camera = Camera.getPosition();
   Vec3 position = getModel().getPosition();
   float dx = camera.getX() - position.getX();
   float dy = camera.getY() - position.getY();
   dx = Math.abs(dx);
   dy = Math.abs(dy);
   dx -= getShape().getWidth() / 2;
   dy -= getShape().getHeight() / 2;
   return dx < 1 && dy < (1 / Constants.RATIO);
 }