Ejemplo n.º 1
0
 protected void renderImpl(final Graphics graphicContext) {
   if (this.recursing) {
     for (final Entity child : this.childrenInOrder) {
       child.render(graphicContext);
     }
   }
 }
Ejemplo n.º 2
0
 public void update(final int deltaInMillis) {
   if (this.recursing) {
     for (final Entity child : this.childrenInOrder) {
       child.update(deltaInMillis);
     }
   }
 }
Ejemplo n.º 3
0
 public void handleInput(final Input input) {
   if (this.recursing) {
     for (final Entity child : this.childrenInOrder) {
       child.handleInput(input);
     }
   }
 }
Ejemplo n.º 4
0
 public void remove(final Entity e) {
   if (this.children.containsKey(e.getId())) {
     this.childrenInOrder.remove(e);
     this.children.remove(e.getId());
   } else {
     throw new IllegalArgumentException("entity with this id doesn't exist");
   }
 }
Ejemplo n.º 5
0
 public boolean handleCollisions() {
   boolean result = false;
   if (this.recursing) {
     for (Entity child : new TreeSet<Entity>(this.childrenInOrder)) {
       result |= child.handleCollisions();
     }
   }
   return result;
 }
Ejemplo n.º 6
0
 public Entity add(final Entity e) {
   if (!this.children.containsKey(e.getId())) {
     this.children.put(e.getId(), e);
     this.childrenInOrder.add(e);
   } else {
     throw new IllegalArgumentException("entity with this id was already added");
   }
   return e;
 }
Ejemplo n.º 7
0
  @Override
  protected void postRender(Graphics graphicContext) {
    super.postRender(graphicContext);

    graphicContext.setColor(Constants.Debug.overlayColor);
    graphicContext.drawString(
        "NetworkID: "
            + NetworkComponent.getInstance().getNetworkId()
            + "\n"
            + factory.size()
            + " entities",
        20,
        50);

    Entity e = this;
    graphicContext.drawString(
        "Level\n"
            + "ID: "
            + e.getId()
            + "\n"
            + " X: "
            + e.getData()[X]
            + "  Y: "
            + e.getData()[Y]
            + "\n"
            + "OX: "
            + e.getData()[CENTER_X]
            + " OY: "
            + e.getData()[CENTER_Y]
            + "\n"
            + "FX: "
            + "SX: "
            + e.getData()[SCALE_X]
            + " SY: "
            + e.getData()[SCALE_Y]
            + "\n"
            + "ROT: "
            + e.getData()[ROTATION],
        20,
        100);

    e = getCurrentPlayer();
    if (e != null) {
      graphicContext.drawString(
          "Player\n"
              + "ID: "
              + e.getId()
              + "\n"
              + " X: "
              + e.getData()[X]
              + "  Y: "
              + e.getData()[Y]
              + "\n"
              + "OX: "
              + e.getData()[CENTER_X]
              + " OY: "
              + e.getData()[CENTER_Y]
              + "SX: "
              + e.getData()[SCALE_X]
              + " SY: "
              + e.getData()[SCALE_Y]
              + "\n"
              + "ROT: "
              + e.getData()[ROTATION]
              + "\n"
              + "STATE: "
              + ((Player) e).currentState,
          20,
          250);
    }
  }
Ejemplo n.º 8
0
 public Entity replace(final Entity e) {
   this.childrenInOrder.remove(this.children.get(e.get(this.id)));
   this.children.put(e.getId(), e);
   this.childrenInOrder.add(e);
   return e;
 }