/** * @deprecated as of odb version 2.0.0 {@see #get} is as safe as getSafe. */ @Deprecated public A getSafe(int entityId) { return mapper.get(entityId); }
@Override protected void internalRemove(int entityId) { // triggers no composition id update A component = get(entityId); if (component != null) purgatory.mark(entityId); }
@Override protected void process(int e) { final Aim aim = am.get(e); final int target = aim.at; if (target != -1) { aimAt(e, target); } }
@Override protected void process(Entity e) { final Pos pos = pm.get(e); cameraSystem.camera.position.x = (int)(pos.x); cameraSystem.camera.position.y = (int)(pos.y); cameraSystem.camera.update(); } }
/** * Checks if the entity has this type of component. * <p> * Removed components flagged with {@link DelayedComponentRemoval} will report {@code false} * immediately after removal but will still be available using {@link #get(int)}. * * @param entityId the id of entity to check * @return {@code true} if the entity has this component type, {@code false} if it doesn't (or if it is scheduled for delayed removal). */ @Override public boolean has(int entityId) { return get(entityId) != null && !purgatory.has(entityId); }
@Override protected void internalRemove(int entityId) { // triggers no composition id update A component = get(entityId); if (component != null) purgatory.mark(entityId); }
public A get(int entityId, boolean forceNewInstance) throws ArrayIndexOutOfBoundsException { A component = mapper.get(entityId); if(component == null && forceNewInstance) { component = mapper.create(entityId); } return component; }
private void writeKeyTag(Json json, Entity e) { if (saveTagMapper.has(e)) { String key = saveTagMapper.get(e).tag; if (key != null) json.writeValue("key", key); } }
@Override protected void check(int id) { Object collection = fieldMutator.read(mapper.get(id), field); fieldMutator.validate(id, collection, listener); }
private void writeKeyTag(Json json, Entity e) { if (saveTagMapper.has(e)) { String key = saveTagMapper.get(e).tag; if (key != null) json.writeValue("key", key); } }
public void clampVelocity(int entity, float minSpeed, float maxSpeed) { if (ym.has(entity)) { final Physics physics = ym.get(entity); clampVelocity(physics, minSpeed, maxSpeed); } }
@Override protected void check(int id) { Object collection = fieldMutator.read(mapper.get(id), field); fieldMutator.validate(id, collection, listener); }
public void clampVelocity(int entity, float minSpeed, float maxSpeed) { if (ym.has(entity)) { final Physics physics = ym.get(entity); clampVelocity(physics, minSpeed, maxSpeed); } }
@Override protected void process(int e) { final Pos pos = pm.get(e); cameraSystem.camera.position.x = (int)(pos.xy.x); cameraSystem.camera.position.y = (int)(pos.xy.y); if ( mAngle.has(e)) { cameraSystem.camera.up.set(0, 1, 0).rotate(cameraSystem.camera.direction, -mAngle.get(e).rotation); } cameraSystem.camera.update(); } }
@Override protected void process(int entityId) { // Explosion explosion = mExplosion.get(entityId); RigidBody rigidBody = mRigidBody.get(entityId); State state = mState.get(entityId); if (state.getStateTime() > 0.75f) { rigidBody.body.getWorld().destroyBody(rigidBody.body); world.delete(entityId); } }
@Override public A internalCreate(int entityId) { A component = get(entityId); if (component == null || purgatory.unmark(entityId)) { component = createNew(); components.unsafeSet(entityId, component); } return component; }
@Override protected void insert(int id) { int target = fieldMutator.read(mapper.get(id), field); sourceToTarget.set(id, target); if (target != -1 && listener != null) listener.onLinkEstablished(id, target); }
public void push(Entity entity, float rotation, float force) { if (ym.has(entity)) { vTmp.set(force, 0).setAngle(rotation); final Physics physics = ym.get(entity); physics.vx += vTmp.x; physics.vy += vTmp.y; } }