protected void renderImpl(final Graphics graphicContext) { if (this.recursing) { for (final Entity child : this.childrenInOrder) { child.render(graphicContext); } } }
public void update(final int deltaInMillis) { if (this.recursing) { for (final Entity child : this.childrenInOrder) { child.update(deltaInMillis); } } }
public void handleInput(final Input input) { if (this.recursing) { for (final Entity child : this.childrenInOrder) { child.handleInput(input); } } }
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"); } }
public boolean handleCollisions() { boolean result = false; if (this.recursing) { for (Entity child : new TreeSet<Entity>(this.childrenInOrder)) { result |= child.handleCollisions(); } } return result; }
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; }
@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); } }
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; }