Beispiel #1
0
 @Override
 public <T extends Event> T send(T event) {
   if (exists()) {
     entityManager.getEventSystem().send(this, event);
   }
   return event;
 }
Beispiel #2
0
 @Override
 public Iterable<Component> iterateComponents() {
   if (exists()) {
     return entityManager.iterateComponents(getId());
   }
   return Collections.emptyList();
 }
Beispiel #3
0
 @Override
 public <T extends Component> T addComponent(T component) {
   if (isActive()) {
     return entityManager.addComponent(getId(), component);
   }
   return component;
 }
Beispiel #4
0
 @Override
 public <T extends Component> T getComponent(Class<T> componentClass) {
   if (exists()) {
     return entityManager.getComponent(getId(), componentClass);
   }
   return null;
 }
Beispiel #5
0
 @Override
 public boolean hasComponent(Class<? extends Component> component) {
   return exists() && entityManager.hasComponent(getId(), component);
 }
Beispiel #6
0
 @Override
 public void destroy() {
   if (isActive()) {
     entityManager.destroy(getId());
   }
 }
Beispiel #7
0
 @Override
 public void saveComponent(Component component) {
   if (isActive()) {
     entityManager.saveComponent(getId(), component);
   }
 }
Beispiel #8
0
 @Override
 public void removeComponent(Class<? extends Component> componentClass) {
   if (isActive()) {
     entityManager.removeComponent(getId(), componentClass);
   }
 }
Beispiel #9
0
 @Override
 public boolean isActive() {
   return exists() && entityManager.isActiveEntity(getId());
 }