@Override public void handled(Object obj) { EntityDeployRequest edr = (EntityDeployRequest) obj; Entity entity; if (!Entity.ingame.containsKey(edr.id)) entity = edr.info.createClientEntity(); else entity = Entity.ingame.get(edr.id); Actor actor = null; if (entity instanceof CardEntity) { actor = new CardEntityView((CardEntity) entity); } else if (entity instanceof CardSlotEntity) { return; // TODO handle update CardSlotEntity } else if (entity instanceof PlayerEntity) { if (edr.isClient) actor = new ClientControlView(stage, (PlayerEntity) entity); else actor = new PlayerEntityView((PlayerEntity) entity); } else return; if (!edr.viewable) return; EntityViewManager.instance.addActor(stage, actor, entity); actor.setPosition( edr.x * stage.getWidth() - actor.getWidth() / 2, edr.y * stage.getHeight() - actor.getHeight() / 2); Log.fine(entity.id() + "@" + entity.getClass().getSimpleName()); }
public void render() { for (int i = 0; i < width * height; i++) { Map[i % width][i / height].render(i % width * 32, i / height * 32); } for (Entity e : entitylist) { e.render(); } for (Particle p : particlelist) { p.render(); } }
public void kill(Entity e) { e.setToDestroy(); if (e instanceof Enemy) { enemyKilledCounter++; e.level.enemyDestroyed((Enemy) e); notifyObservers(); } }