/** Fetch manager or throw RuntimeException if not registered. */ protected <T extends BaseSystem> T resolveManager(Class<T> type) { final T teamManager = world.getSystem(type); if ( teamManager == null ) { throw new RuntimeException("Register " + ClassReflection.getSimpleName(type) + " with your artemis world."); } return teamManager; } }
/** Fetch manager or throw RuntimeException if not registered. */ protected <T extends BaseSystem> T resolveManager(Class<T> type) { final T teamManager = world.getSystem(type); if ( teamManager == null ) { throw new RuntimeException("Register " + ClassReflection.getSimpleName(type) + " with your artemis world."); } return teamManager; } }
public EntitySubscription getSubscription(Aspect.Builder aspectA) { final AspectSubscriptionManager sm = world.getSystem(AspectSubscriptionManager.class); return sm.get(aspectA); }
@Override @SuppressWarnings("unchecked") public Object resolve(Object target, Class<?> fieldType, Field field) { ClassType injectionType = cache.getFieldClassType(fieldType); switch (injectionType) { case MAPPER: return getComponentMapper(field); case SYSTEM: return world.getSystem((Class<BaseSystem>) systems.get(fieldType)); case WORLD: return world; default: return null; } }
public E tag(String tag) { mappers.getWorld().getSystem(com.artemis.managers.TagManager.class).register(tag, entityId); return this; }
/** * Get entity by tag. * @return {@code E}, or {@code null} if no such tag. */ public static E withTag(String tag) { if(_processingMapper==null) throw new RuntimeException("SuperMapper system must be registered before any systems using E().");; int id=_processingMapper.getWorld().getSystem(com.artemis.managers.TagManager.class).getEntityId(tag); return id != -1 ? E(id) : null; }
public String tag() { return mappers.getWorld().getSystem(com.artemis.managers.TagManager.class).getTag(entityId); }
/** * Get entities in group.. * @return {@code EBag} of entities in group. Returns empty bag if group contains no entities. */ public static EBag withGroup(String groupName) { if(_processingMapper==null) throw new RuntimeException("SuperMapper system must be registered before any systems using E().");; return new EBag((com.artemis.utils.IntBag)_processingMapper.getWorld().getSystem(com.artemis.managers.GroupManager.class).getEntityIds(groupName)); }
/** * Get entity by tag. * @return {@code E}, or {@code null} if no such tag. */ public static E withTag(String tag) { if(_processingMapper==null) throw new RuntimeException("SuperMapper system must be registered before any systems using E().");; int id=_processingMapper.getWorld().getSystem(com.artemis.managers.TagManager.class).getEntityId(tag); return id != -1 ? E(id) : null; }
/** * Get entities in group.. * @return {@code EBag} of entities in group. Returns empty bag if group contains no entities. */ public static EBag withGroup(String groupName) { if(_processingMapper==null) throw new RuntimeException("SuperMapper system must be registered before any systems using E().");; return new EBag((com.artemis.utils.IntBag)_processingMapper.getWorld().getSystem(com.artemis.managers.GroupManager.class).getEntityIds(groupName)); }
public E removeGroups() { World w = mappers.getWorld(); w.getSystem(com.artemis.managers.GroupManager.class).removeFromAllGroups(w.getEntity(entityId)); return this; }
public E group(String group) { World w = mappers.getWorld(); w.getSystem(com.artemis.managers.GroupManager.class).add(w.getEntity(entityId), group); return this; }
public E removeGroup(String group) { World w = mappers.getWorld(); w.getSystem(com.artemis.managers.GroupManager.class).remove(w.getEntity(entityId), group); return this; }
public E removeGroups() { World w = mappers.getWorld(); w.getSystem(com.artemis.managers.GroupManager.class).removeFromAllGroups(w.getEntity(entityId)); return this; }
public ImmutableBag<String> groups() { World w = mappers.getWorld(); return w.getSystem(com.artemis.managers.GroupManager.class).getGroups(w.getEntity(entityId)); }
public boolean isInGroup(String group) { World w = mappers.getWorld(); return w.getSystem(com.artemis.managers.GroupManager.class).isInGroup(w.getEntity(entityId), group); }
public E removeGroup(String group) { World w = mappers.getWorld(); w.getSystem(com.artemis.managers.GroupManager.class).remove(w.getEntity(entityId), group); return this; }
public E group(String group) { World w = mappers.getWorld(); w.getSystem(com.artemis.managers.GroupManager.class).add(w.getEntity(entityId), group); return this; }
protected BasePrefab(World world, PrefabReader<DATA> data) { this.world = world; this.data = data; serializationManager = world.getSystem(WorldSerializationManager.class); if (serializationManager == null) throw new MundaneWireException(WorldSerializationManager.class); world.inject(this); // TODO: #439 - generate .class from .json data.initialize(getPrefabDataPath()); }
protected BasePrefab(World world, PrefabReader<DATA> data) { this.world = world; this.data = data; serializationManager = world.getSystem(WorldSerializationManager.class); if (serializationManager == null) throw new MundaneWireException(WorldSerializationManager.class); world.inject(this); // TODO: #439 - generate .class from .json data.initialize(getPrefabDataPath()); }