本文整理了Java中com.artemis.Entity
类的一些代码示例,展示了Entity
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity
类的具体详情如下:
包路径:com.artemis.Entity
类名称:Entity
[英]The entity class. Cannot be instantiated outside the framework, you must create new entities using World.
[中]实体类。无法在框架外实例化,必须使用World创建新实体。
代码示例来源:origin: junkdog/artemis-odb
@Override
public int read(Component c, Field f) {
Entity e = ((UniEntityLink) c).field;
return (e != null) ? e.getId() : -1;
}
代码示例来源:origin: DaanVanYperen/artemis-odb-contrib
@SuppressWarnings("unchecked")
protected T editEntity(Entity entity) {
this.entity = entity;
this.edit = entity.edit();
return (T) this;
}
代码示例来源:origin: net.mostlyoriginal.artemis-odb/contrib-jam
public static float distance2( final Entity a, final Entity b)
{
final Pos pa = (Pos)a.getComponent(Pos.class);
final Pos pb = (Pos)b.getComponent(Pos.class);
return tmp.set(pa.xy.x, pa.xy.y).dst2(pb.xy.x, pb.xy.y);
}
代码示例来源:origin: junkdog/artemis-odb
@Override
public void deleted(Entity e) {
UUID uuid = entityToUuid.safeGet(e.getId());
if (uuid == null)
return;
Entity oldEntity = uuidToEntity.get(uuid);
if (oldEntity != null && oldEntity.equals(e))
uuidToEntity.remove(uuid);
entityToUuid.set(e.getId(), null);
}
代码示例来源:origin: junkdog/artemis-odb
output.writeInt(e.getId());
return;
} else {
world.getComponentManager().getComponentsFor(e.getId(), components);
components.sort(comparator);
output.writeInt(e.getCompositionId());
代码示例来源: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);
}
}
}
代码示例来源:origin: net.mostlyoriginal.artemis-odb/contrib-plugin-operations
@Override
public void process(Entity e) {
e.deleteFromWorld();
}
}
代码示例来源:origin: junkdog/artemis-odb
private void writeArchetype(Json json, Entity e) {
json.writeValue("archetype", e.getCompositionId());
}
代码示例来源: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: junkdog/artemis-odb
/**
* Returns whether this Aspect would accept the given Entity.
*/
public boolean isInterested(Entity e){
return isInterested(e.getComponentBits());
}
代码示例来源:origin: junkdog/artemis-odb
public static Entity create(World world, int entityId) {
return new Entity(world, entityId);
}
}
代码示例来源:origin: apotapov/gdx-artemis
boolean contains = e.getSystemBits().get(systemIndex);
boolean interested = true; // possibly interested, let's try to prove it wrong.
Bits componentBits = e.getComponentBits();
代码示例来源:origin: net.onedaybeard.artemis/artemis-odb-serializer-kryo
output.writeInt(e.getId());
return;
} else {
world.getComponentManager().getComponentsFor(e.getId(), components);
components.sort(comparator);
output.writeInt(e.getCompositionId());
代码示例来源:origin: net.onedaybeard.artemis/artemis-odb
@Override
public void deleted(Entity e) {
UUID uuid = entityToUuid.safeGet(e.getId());
if (uuid == null)
return;
Entity oldEntity = uuidToEntity.get(uuid);
if (oldEntity != null && oldEntity.equals(e))
uuidToEntity.remove(uuid);
entityToUuid.set(e.getId(), null);
}
代码示例来源:origin: net.mostlyoriginal.artemis-odb/contrib-components-libgdx
@Override
public boolean act(float delta, Entity e) {
e.deleteFromWorld();
return true;
}
代码示例来源:origin: junkdog/artemis-odb
private void writeArchetype(Json json, Entity e) {
json.writeValue("archetype", e.getCompositionId());
}
代码示例来源: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: junkdog/artemis-odb
/**
* Returns whether this Aspect would accept the given Entity.
*/
public boolean isInterested(Entity e){
return isInterested(e.getComponentBits());
}
代码示例来源:origin: apotapov/gdx-artemis
@Override
protected Entity newObject() {
return new Entity(world);
}
代码示例来源:origin: junkdog/artemis-odb
/**
* Create or remove a component from an entity.
*
* Does nothing if already removed or created respectively.
*
* @param entity Entity to change.
* @param value {@code true} to create component (if missing), {@code false} to remove (if exists).
* @return the instance of the component, or {@code null} if removed.
*/
public A set(Entity entity, boolean value) {
return set(entity.getId(), value);
}
内容来源于网络,如有侵权,请联系作者删除!