com.artemis.Entity.isActive()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(171)

本文整理了Java中com.artemis.Entity.isActive()方法的一些代码示例,展示了Entity.isActive()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.isActive()方法的具体详情如下:
包路径:com.artemis.Entity
类名称:Entity
方法名:isActive

Entity.isActive介绍

[英]Checks if the entity has been added to the world and has not been deleted from it. If the entity has been disabled this will still return true.
[中]

代码示例

代码示例来源:origin: net.mostlyoriginal.artemis-odb/contrib-plugin-operations

@Override
public boolean process(float delta, Entity e) {
  if (!completed && e.isActive()) {
    if ( operation.process(delta,e) ) {
      completed = (desiredRepetitions != UNLIMITED) && (++repetition >= desiredRepetitions);
      if ( !completed ) {
        operation.rewind();
      }
    }
  }
  return completed;
}

代码示例来源:origin: DaanVanYperen/artemis-odb-contrib

@Override
public boolean process(float delta, Entity e) {
  if (!completed && e.isActive()) {
    if ( operation.process(delta,e) ) {
      completed = (desiredRepetitions != UNLIMITED) && (++repetition >= desiredRepetitions);
      if ( !completed ) {
        operation.rewind();
      }
    }
  }
  return completed;
}

代码示例来源:origin: apotapov/gdx-artemis

/**
 * Remove component by its type.
 * @param type Type of component to remove.
 * 
 * @return this entity for chaining.
 */
public Entity removeComponent(Class<? extends Component> type) {
  componentManager.removeComponent(this, type);
  if (isActive()) {
    world.changedEntity(this);
  }
  return this;
}

代码示例来源:origin: apotapov/gdx-artemis

/**
 * Add a component to this entity.
 * 
 * @param component to add to this entity
 * 
 * @return this entity for chaining.
 */
public Entity addComponent(Component component) {
  componentManager.addComponent(this, component);
  if (isActive()) {
    world.changedEntity(this);
  }
  return this;
}

代码示例来源:origin: DaanVanYperen/artemis-odb-contrib

protected void nextOperation(float delta, Entity e, Operation operation) {
  Preconditions.checkArgument(!operation.isCompleted(), "Operation should never be completed before the first process.");
  if ( e.isActive() && operation.process(delta, e)) {
    index++;
  }
}

代码示例来源:origin: net.mostlyoriginal.artemis-odb/contrib-plugin-operations

protected void nextOperation(float delta, Entity e, Operation operation) {
  Preconditions.checkArgument(!operation.isCompleted(), "Operation should never be completed before the first process.");
  if ( e.isActive() && operation.process(delta, e)) {
    index++;
  }
}

代码示例来源:origin: net.mostlyoriginal.artemis-odb/contrib-plugin-operations

@Override
  public boolean process(float delta, Entity e) {
    if ( isCompleted() ) return true;

    boolean operationsRemain = false;
    for (int i = 0; i < operations.size; i++) {
      if (!e.isActive()) break;
      final Operation operation = operations.get(i);
      if (!operation.process(delta, e)) {
        operationsRemain = true;
      }
    }

    completed = !operationsRemain;

    return completed;
  }
}

代码示例来源:origin: DaanVanYperen/artemis-odb-contrib

@Override
  public boolean process(float delta, Entity e) {
    if ( isCompleted() ) return true;

    boolean operationsRemain = false;
    for (int i = 0; i < operations.size; i++) {
      if (!e.isActive()) break;
      final Operation operation = operations.get(i);
      if (!operation.process(delta, e)) {
        operationsRemain = true;
      }
    }

    completed = !operationsRemain;

    return completed;
  }
}

代码示例来源:origin: net.mostlyoriginal.artemis-odb/contrib-components-libgdx

@Override
  protected void process(Entity e) {

    Schedule schedule = sm.get(e);
    schedule.age += world.delta;

    final Array<Step> steps = schedule.steps;
    for (int i = 0; i < steps.size; i++) {
      final Step step = steps.get(i);
      if (schedule.age >= step.atAge && step.act(world.delta, e) && i < steps.size) {
        steps.removeIndex(i);
        step.release();
        i--;
        if ( !e.isActive() ) return;
      }
    }

    if (schedule.steps.size == 0 && e.isActive() ) {
      e.edit().remove(Schedule.class);
    }
  }
}

相关文章