コード例 #1
0
ファイル: Entity.java プロジェクト: macs672/rgb4
 protected void renderImpl(final Graphics graphicContext) {
   if (this.recursing) {
     for (final Entity child : this.childrenInOrder) {
       child.render(graphicContext);
     }
   }
 }
コード例 #2
0
ファイル: Entity.java プロジェクト: macs672/rgb4
 public void update(final int deltaInMillis) {
   if (this.recursing) {
     for (final Entity child : this.childrenInOrder) {
       child.update(deltaInMillis);
     }
   }
 }
コード例 #3
0
ファイル: Entity.java プロジェクト: macs672/rgb4
 public void handleInput(final Input input) {
   if (this.recursing) {
     for (final Entity child : this.childrenInOrder) {
       child.handleInput(input);
     }
   }
 }
コード例 #4
0
ファイル: Entity.java プロジェクト: macs672/rgb4
 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");
   }
 }
コード例 #5
0
ファイル: Entity.java プロジェクト: macs672/rgb4
 public boolean handleCollisions() {
   boolean result = false;
   if (this.recursing) {
     for (Entity child : new TreeSet<Entity>(this.childrenInOrder)) {
       result |= child.handleCollisions();
     }
   }
   return result;
 }
コード例 #6
0
ファイル: Entity.java プロジェクト: macs672/rgb4
 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;
 }
コード例 #7
0
ファイル: Level.java プロジェクト: bullerta/rgb4
  @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);
    }
  }
コード例 #8
0
ファイル: Entity.java プロジェクト: macs672/rgb4
 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;
 }