Java Code Examples for com.artemis.utils.IntBag#get()

The following examples show how to use com.artemis.utils.IntBag#get() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RenderSystem.java    From riiablo with Apache License 2.0 6 votes vote down vote up
private void buildCache(Array<Integer>[] cache, Map.Zone zone, int stx, int sty) {
  cache[0].size = cache[1].size = cache[2].size = 0;
  int orderFlag;
  IntBag entitites = getEntityIds();
  for (int i = 0, size = entitites.size(); i < size; i++) {
    int id = entitites.get(i);
    Vector2 pos = mPosition.get(id).position;
    if ((stx <= pos.x && pos.x < stx + Tile.SUBTILE_SIZE)
     && (sty <= pos.y && pos.y < sty + Tile.SUBTILE_SIZE)) {
      Object objectComponent = mObject.get(id);
      if (objectComponent != null) {
        CofReference reference = mCofReference.get(id);
        orderFlag = objectComponent.base.OrderFlag[reference.mode];
      } else {
        orderFlag = stx == pos.x || sty == pos.y ? 2 : 0;
      }

      cache[orderFlag].add(id);
    }
  }
  cache[0].sort(SUBTILE_ORDER);
  cache[1].sort(SUBTILE_ORDER);
  cache[2].sort(SUBTILE_ORDER);
}
 
Example 2
Source File: CofLayerUnloader.java    From riiablo with Apache License 2.0 5 votes vote down vote up
@Override
protected void dispose() {
  IntBag entities = getEntityIds();
  for (int i = 0, size = entities.size(); i < size; i++) {
    int id = entities.get(i);
    AssetDescriptor<? extends DC>[] descriptors = mCofComponentDescriptors.get(id).descriptors;
    for (int c = 0; c < descriptors.length; c++) {
      layerLoader.unload(c, descriptors);
    }
  }
}
 
Example 3
Source File: CursorMovementSystem.java    From riiablo with Apache License 2.0 5 votes vote down vote up
private boolean touchDown(int src) {
  IntBag hoveredEntities = hoveredSubscriber.getEntities();
  if (hoveredEntities.size() == 0) return false;
  int target = hoveredEntities.get(0);
  setTarget(src, target);
  return true;
}
 
Example 4
Source File: CofUnloader.java    From riiablo with Apache License 2.0 5 votes vote down vote up
@Override
protected void dispose() {
  IntBag entities = getEntityIds();
  for (int i = 0, size = entities.size(); i < size; i++) {
    int id = entities.get(i);
    unload(id);
  }
}
 
Example 5
Source File: SoundEmitterHandler.java    From riiablo with Apache License 2.0 5 votes vote down vote up
@Override
protected void dispose() {
  IntBag entities = getEntityIds();
  for (int i = 0, size = entities.size(); i < size; i++) {
    int id = entities.get(i);
    unload(id);
  }
}
 
Example 6
Source File: MonsterLabelManager.java    From riiablo with Apache License 2.0 5 votes vote down vote up
@Override
protected void processSystem() {
  IntBag entities = getEntityIds();
  if (entities.size() > 0) {
    int firstId = entities.get(0);
    monsterLabel.set(firstId);
    monsterLabel.setVisible(true);
  }
}