@Override public <T extends Event> T send(T event) { if (exists()) { entityManager.getEventSystem().send(this, event); } return event; }
@Override public Iterable<Component> iterateComponents() { if (exists()) { return entityManager.iterateComponents(getId()); } return Collections.emptyList(); }
@Override public <T extends Component> T addComponent(T component) { if (isActive()) { return entityManager.addComponent(getId(), component); } return component; }
@Override public <T extends Component> T getComponent(Class<T> componentClass) { if (exists()) { return entityManager.getComponent(getId(), componentClass); } return null; }
@Override public boolean hasComponent(Class<? extends Component> component) { return exists() && entityManager.hasComponent(getId(), component); }
@Override public void destroy() { if (isActive()) { entityManager.destroy(getId()); } }
@Override public void saveComponent(Component component) { if (isActive()) { entityManager.saveComponent(getId(), component); } }
@Override public void removeComponent(Class<? extends Component> componentClass) { if (isActive()) { entityManager.removeComponent(getId(), componentClass); } }
@Override public boolean isActive() { return exists() && entityManager.isActiveEntity(getId()); }